mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-18 14:57:37 +08:00
system message: recover orphan tool-call 400 by retrying with fresh context
This commit is contained in:
@@ -903,6 +903,20 @@ func (al *AgentLoop) processSystemMessage(ctx context.Context, msg bus.InboundMe
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
errMsg := strings.ToLower(err.Error())
|
||||||
|
if strings.Contains(errMsg, "no tool call found for function call output") {
|
||||||
|
logger.WarnCF("agent", "System message hit orphan tool-call chain, retry with fresh context", map[string]interface{}{"iteration": iteration, "session": sessionKey})
|
||||||
|
messages = al.contextBuilder.BuildMessages(
|
||||||
|
nil,
|
||||||
|
"",
|
||||||
|
msg.Content,
|
||||||
|
nil,
|
||||||
|
originChannel,
|
||||||
|
originChatID,
|
||||||
|
responseLang,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
logger.ErrorCF("agent", "LLM call failed in system message",
|
logger.ErrorCF("agent", "LLM call failed in system message",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"iteration": iteration,
|
"iteration": iteration,
|
||||||
|
|||||||
Reference in New Issue
Block a user