fix limiter
This commit is contained in:
parent
58c85b8dfd
commit
0cfb28fce7
|
|
@ -18,6 +18,14 @@ public partial class RoutingService
|
|||
if (Context.CurrentRecursionDepth > agent.LlmConfig.MaxRecursionDepth)
|
||||
{
|
||||
_logger.LogWarning($"Current recursive call depth greater than {agent.LlmConfig.MaxRecursionDepth}, which will cause unexpected result.");
|
||||
// The caller surfaces the LAST dialog as the turn's reply, so returning here with a tool
|
||||
// frame on top of the history would answer the user with a raw tool result. Add an
|
||||
// explicit notice so an exhausted tool loop always ends with an assistant message.
|
||||
var limit = RoleDialogModel.From(dialogs.Last(), role: AgentRole.Assistant,
|
||||
content: "Stopped after reaching this agent's tool-call limit without a final answer.");
|
||||
limit.CurrentAgentId = agent.Id;
|
||||
dialogs.Add(limit);
|
||||
Context.AddDialogs([limit]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue