reload agent in case it has been changed by hook

This commit is contained in:
Haiping Chen 2024-09-30 15:33:14 -05:00
parent 26de11f18f
commit 06d0b398fc

View file

@ -74,6 +74,12 @@ public partial class ConversationService
// Routing with reasoning
var settings = _services.GetRequiredService<RoutingSettings>();
// reload agent in case it has been changed by hook
if (message.CurrentAgentId != agent.Id)
{
agent = await agentService.LoadAgent(message.CurrentAgentId);
}
if (agent.Type == AgentType.Routing)
{
response = await routing.InstructLoop(message, dialogs);