fix GetCurrentAgentId

This commit is contained in:
Haiping Chen 2024-02-28 20:45:01 -06:00
parent b2650a31e1
commit beb82c855a
2 changed files with 6 additions and 1 deletions

View file

@ -53,6 +53,11 @@ public class RoutingContext : IRoutingContext
public string GetCurrentAgentId()
{
if (_stack.Count == 0)
{
return string.Empty;
}
return _stack.Peek();
}

View file

@ -182,7 +182,7 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook, IR
var agent = await _agentService.LoadAgent(agentId);
var currentAgent = await _agentService.LoadAgent(currentAgentId);
var log = $"{agent.Name} is dequeued{(reason != null ? $" ({reason})" : "")}, current agent is {currentAgent.Name}";
var log = $"{agent.Name} is dequeued{(reason != null ? $" ({reason})" : "")}, current agent is {currentAgent?.Name}";
await _chatHub.Clients.User(_user.Id).SendAsync("OnConversationContentLogGenerated",
BuildContentLog(conversationId, "Router", log, ContentLogSource.HardRule, new RoleDialogModel(AgentRole.System, log)
{