feat: implement strict-client compatible streaming tool calls with index and add Vercel build troubleshooting guide.

This commit is contained in:
CJACK
2026-02-16 17:58:40 +08:00
parent c7ed01bfe7
commit 63ee2e41c2
7 changed files with 111 additions and 1 deletions

View File

@@ -298,3 +298,20 @@ func FormatOpenAIToolCalls(calls []ParsedToolCall) []map[string]any {
}
return out
}
func FormatOpenAIStreamToolCalls(calls []ParsedToolCall) []map[string]any {
out := make([]map[string]any, 0, len(calls))
for i, c := range calls {
args, _ := json.Marshal(c.Input)
out = append(out, map[string]any{
"index": i,
"id": "call_" + strings.ReplaceAll(uuid.NewString(), "-", ""),
"type": "function",
"function": map[string]any{
"name": c.Name,
"arguments": string(args),
},
})
}
return out
}