Fix reasoning_content error in tool calls for kimi-k2.5 and other thinking models

This commit is contained in:
jdhxyy 2026-02-27 20:28:42 +08:00
parent 29d4019e62
commit b33929fd13
2 changed files with 15 additions and 8 deletions

5
.gitignore vendored
View file

@ -12,6 +12,11 @@ build/
/picoclaw-test /picoclaw-test
cmd/**/workspace cmd/**/workspace
# Go debug binaries (created by VS Code Go extension)
__debug_bin
__debug_bin.exe
__debug_bin*
# Picoclaw specific # Picoclaw specific
# PicoClaw # PicoClaw

View file

@ -286,6 +286,7 @@ func parseResponse(body []byte) (*LLMResponse, error) {
type openaiMessage struct { type openaiMessage struct {
Role string `json:"role"` Role string `json:"role"`
Content string `json:"content"` Content string `json:"content"`
ReasoningContent string `json:"reasoning_content,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"`
} }
@ -299,6 +300,7 @@ func stripSystemParts(messages []Message) []openaiMessage {
out[i] = openaiMessage{ out[i] = openaiMessage{
Role: m.Role, Role: m.Role,
Content: m.Content, Content: m.Content,
ReasoningContent: m.ReasoningContent,
ToolCalls: m.ToolCalls, ToolCalls: m.ToolCalls,
ToolCallID: m.ToolCallID, ToolCallID: m.ToolCallID,
} }