feat: Improve OpenAI tool call handling by passing unknown tool calls as content and filtering streamed tool calls by schema.

This commit is contained in:
CJACK
2026-02-22 19:33:52 +08:00
parent 312728c8b6
commit ae7dce0b32
26 changed files with 1109 additions and 501 deletions

View File

@@ -3,11 +3,18 @@ package openai
import "net/http"
func writeOpenAIError(w http.ResponseWriter, status int, message string) {
writeOpenAIErrorWithCode(w, status, message, "")
}
func writeOpenAIErrorWithCode(w http.ResponseWriter, status int, message, code string) {
if code == "" {
code = openAIErrorCode(status)
}
writeJSON(w, status, map[string]any{
"error": map[string]any{
"message": message,
"type": openAIErrorType(status),
"code": openAIErrorCode(status),
"code": code,
"param": nil,
},
})