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:
@@ -440,7 +440,7 @@ func (s *Server) postPhoneAPI(endpoint string, payload map[string]string, out *p
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("plugin_type", "zhanlu_ide")
|
||||
req.Header.Set("plugin_version", s.cfg.PluginVersion)
|
||||
req.Header.Set("request", randomRequestID())
|
||||
req.Header.Set("request", util.RandomRequestID())
|
||||
resp, err := s.upstreamHTTPClient().Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1093,10 +1093,6 @@ func forEachSSEChunk(r io.Reader, fn func([]byte) error) error {
|
||||
if payload == "" || payload == "[DONE]" {
|
||||
continue
|
||||
}
|
||||
var upstreamError map[string]any
|
||||
if json.Unmarshal([]byte(payload), &upstreamError) == nil && upstreamError["state"] == "ERROR" {
|
||||
return fmt.Errorf("zhanlu upstream error: %v", upstreamError["errorMessage"])
|
||||
}
|
||||
if err := fn([]byte(payload)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user