Mirror Zhanlu client: GLM tool_stream, shared v4 UUID request id, drop chat state:ERROR
build / build (push) Successful in 2m26s
build / build (push) Successful in 2m26s
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user