From b33929fd130f3cd34f0eae6d0ff018538122df5b Mon Sep 17 00:00:00 2001 From: jdhxyy Date: Fri, 27 Feb 2026 20:28:42 +0800 Subject: [PATCH] Fix reasoning_content error in tool calls for kimi-k2.5 and other thinking models --- .gitignore | 5 +++++ pkg/providers/openai_compat/provider.go | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 3ff195fbf..8a3f26946 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,11 @@ build/ /picoclaw-test cmd/**/workspace +# Go debug binaries (created by VS Code Go extension) +__debug_bin +__debug_bin.exe +__debug_bin* + # Picoclaw specific # PicoClaw diff --git a/pkg/providers/openai_compat/provider.go b/pkg/providers/openai_compat/provider.go index 7dace71f2..37a720941 100644 --- a/pkg/providers/openai_compat/provider.go +++ b/pkg/providers/openai_compat/provider.go @@ -284,10 +284,11 @@ func parseResponse(body []byte) (*LLMResponse, error) { // It mirrors protocoltypes.Message but omits SystemParts, which is an // internal field that would be unknown to third-party endpoints. type openaiMessage struct { - Role string `json:"role"` - Content string `json:"content"` - ToolCalls []ToolCall `json:"tool_calls,omitempty"` - ToolCallID string `json:"tool_call_id,omitempty"` + Role string `json:"role"` + Content string `json:"content"` + ReasoningContent string `json:"reasoning_content,omitempty"` + ToolCalls []ToolCall `json:"tool_calls,omitempty"` + ToolCallID string `json:"tool_call_id,omitempty"` } // stripSystemParts converts []Message to []openaiMessage, dropping the @@ -297,10 +298,11 @@ func stripSystemParts(messages []Message) []openaiMessage { out := make([]openaiMessage, len(messages)) for i, m := range messages { out[i] = openaiMessage{ - Role: m.Role, - Content: m.Content, - ToolCalls: m.ToolCalls, - ToolCallID: m.ToolCallID, + Role: m.Role, + Content: m.Content, + ReasoningContent: m.ReasoningContent, + ToolCalls: m.ToolCalls, + ToolCallID: m.ToolCallID, } } return out