feat: integrate reasoning content into assistant tool-call messages and improve tool markup parsing for prompt compatibility

This commit is contained in:
CJACK
2026-05-09 23:16:07 +08:00
parent 9e9a7f1bec
commit 067cf465bb
15 changed files with 513 additions and 14 deletions

View File

@@ -81,6 +81,22 @@ func (s *responsesStreamRuntime) buildCompletedResponseObject(finalThinking, fin
},
},
})
} else if len(calls) > 0 && strings.TrimSpace(finalThinking) != "" {
indexed = append(indexed, indexedItem{
index: s.ensureMessageOutputIndex(),
item: map[string]any{
"id": s.ensureMessageItemID(),
"type": "message",
"role": "assistant",
"status": "completed",
"content": []map[string]any{
{
"type": "reasoning",
"text": finalThinking,
},
},
},
})
} else if len(calls) == 0 {
content := make([]map[string]any, 0, 2)
if finalThinking != "" {