Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ public async Task<bool> InvokeFunction(string name, RoleDialogModel message, Inv
clonedMessage.FunctionName = name;
clonedMessage.Indication = await funcExecutor.GetIndicatorAsync(message);

var conv = _services.GetRequiredService<IConversationService>();
var messageHub = _services.GetRequiredService<MessageHub<HubObserveData<RoleDialogModel>>>();
messageHub.Push(new()
// An empty indicator means the callee has nothing worth announcing for this call.
if (!string.IsNullOrEmpty(clonedMessage.Indication))
{
EventName = ChatEvent.OnIndicationReceived,
Data = clonedMessage,
RefId = conv.ConversationId
});
var conv = _services.GetRequiredService<IConversationService>();
var messageHub = _services.GetRequiredService<MessageHub<HubObserveData<RoleDialogModel>>>();
messageHub.Push(new()
{
EventName = ChatEvent.OnIndicationReceived,
Data = clonedMessage,
RefId = conv.ConversationId
});
}

var hooks = _services.GetHooksOrderByPriority<IConversationHook>(clonedMessage.CurrentAgentId);
foreach (var hook in hooks)
Expand All @@ -44,6 +48,10 @@ public async Task<bool> InvokeFunction(string name, RoleDialogModel message, Inv
await hook.OnFunctionExecuting(clonedMessage, options);
}

// Already pushed and logged: clear it so nested calls resolve their own indication
// instead of inheriting this one through GetIndication's `message.Indication ??` fallback.
clonedMessage.Indication = null;

bool result = false;

try
Expand Down
Loading