fix: deduplicate assistant content in multi-tool turns to prevent premature loop exit

- process.go: only emit resp.Content on the first tool call per batch,
  subsequent assistant messages use empty content (serialized as null)
- provider.go: MarshalJSON outputs null content when empty with tool_calls
  to comply with DeepSeek/OpenAI expected format
- output.go: update parameter interface (payload/type/meta) to match
  tool definitions (uncommitted from previous refactor)
This commit is contained in:
root
2026-07-22 17:05:04 +08:00
parent 85992902d9
commit bd0f84c1f7
3 changed files with 44 additions and 19 deletions

View File

@ -47,8 +47,10 @@ func (m Message) MarshalJSON() ([]byte, error) {
}
if len(m.Blocks) > 0 {
raw["content"] = m.Blocks
} else {
} else if m.Content != "" || len(m.ToolCalls) == 0 {
raw["content"] = m.Content
} else {
raw["content"] = nil
}
if m.ReasoningContent != "" {
raw["reasoning_content"] = m.ReasoningContent