chat_completions_via_responses.go
6.91 KB
-
fix(relay): preserve Kimi K3 dynamic tool loading messages · 6e10f9bc
Kimi K3 injects tools mid-conversation via a system message that carries a `tools` array. `dto.Message` had no such field, so the tools were silently dropped during the parse/re-marshal round trip and the upstream rejected the request with `'tool_choice'='required' requires a 'tools' field`. - add `Message.Tools` (json.RawMessage passthrough) - omit the `content` key only for tool-loading messages with nil content, as Kimi rejects `tools` next to `content`; all other messages keep emitting `"content": null` - count message-level tools in token estimation - skip tool-loading messages in channel system prompt injection and make the compatible handler reuse applySystemPromptIfNeeded - add kimi-k3 to the moonshot model list Fixes #7235
CaIon committed