fix: preserve ReasoningContent in toolloop for thinking models
When using thinking models (e.g., Kimi K2.5), the API requires all assistant messages with tool calls to include reasoning_content. This field was missing in RunToolLoop, causing subagent failures with the error: 已启用思考功能,但索引2处的助手工具调用消息中缺少推理内容 Aligns toolloop.go with the existing handling in agent/loop.go.
This commit is contained in:
parent
39998a6618
commit
53ddf35b78
1 changed files with 3 additions and 2 deletions
|
|
@ -99,6 +99,7 @@ func RunToolLoop(ctx context.Context, config ToolLoopConfig, messages []provider
|
||||||
assistantMsg := providers.Message{
|
assistantMsg := providers.Message{
|
||||||
Role: "assistant",
|
Role: "assistant",
|
||||||
Content: response.Content,
|
Content: response.Content,
|
||||||
|
ReasoningContent: response.ReasoningContent, // Preserve for thinking models (e.g., GLM-Z1)
|
||||||
}
|
}
|
||||||
for _, tc := range response.ToolCalls {
|
for _, tc := range response.ToolCalls {
|
||||||
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue