fix: resolve doubao-seed-1.6-250615 model API 400 error with empty content

- Fix Tool message content issue when model returns empty content in function calling
- Add content validation in callModelWithLogging to handle empty content in messages
- Ensure compatibility between UI-TARS and function calling models

This resolves the "missing messages.content parameter" error when using 
doubao-seed-1.6-250615 model compared to doubao-1.5-ui-tars-250328
This commit is contained in:
lilong.129
2025-06-26 10:57:27 +08:00
parent 191235e3f2
commit e070801b00
3 changed files with 35 additions and 4 deletions
+9 -1
View File
@@ -135,9 +135,17 @@ func (p *Planner) Plan(ctx context.Context, opts *PlanningOptions) (result *Plan
for _, toolCall := range message.ToolCalls {
toolCallID += toolCall.ID
}
// Ensure content is not empty for Tool messages to avoid API 400 errors
// Some models may return empty content when using function calling
toolContent := message.Content
if toolContent == "" {
toolContent = "Function call initiated"
}
p.history.Append(&schema.Message{
Role: schema.Tool,
Content: message.Content,
Content: toolContent,
ToolCalls: message.ToolCalls,
ToolCallID: toolCallID,
})