Mirror Zhanlu client: GLM tool_stream, shared v4 UUID request id, drop chat state:ERROR
build / build (push) Successful in 2m26s

This commit is contained in:
2026-08-21 14:27:37 +08:00
parent a0a2049440
commit b9a3f8d5cd
4 changed files with 32 additions and 17 deletions
+9 -1
View File
@@ -1,6 +1,9 @@
package openai
import "encoding/json"
import (
"encoding/json"
"strings"
)
type ChatCompletionRequest struct {
Model string `json:"model"`
@@ -40,6 +43,11 @@ func (r ChatCompletionRequest) MarshalForUpstream() ([]byte, error) {
m[k] = anyValue
}
}
// Mirror the Zhanlu plugin: GLM models require {tool_stream:true} to
// stream tool calls back to the client (matches /glm/i.test(model)).
if strings.Contains(strings.ToLower(r.Model), "glm") {
m["tool_stream"] = true
}
return json.Marshal(m)
}