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:
@@ -210,7 +210,7 @@ func (c *Client) setPluginHeaders(req *http.Request) {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("plugin_type", "zhanlu_ide")
|
||||
req.Header.Set("plugin_version", c.PluginVersion)
|
||||
req.Header.Set("request", randomRequestID())
|
||||
req.Header.Set("request", util.RandomRequestID())
|
||||
}
|
||||
|
||||
func decodeJSON(resp *http.Response, out any) error {
|
||||
@@ -249,12 +249,4 @@ func randomAlnum(n int) string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func randomRequestID() string {
|
||||
b := make([]byte, 16)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
return fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
}
|
||||
b[6] = (b[6] & 0x0f) | 0x40
|
||||
b[8] = (b[8] & 0x3f) | 0x80
|
||||
return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user