mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 17:46:37 +08:00
refactor: Increase performance by optimizing text relay functionality
``` - Refactor relay-text controller to improve readability and maintainability - Optimize database queries for improved performance - Update error handling to provide more informative messages ```
This commit is contained in:
parent
e382322445
commit
fd7585550a
@ -448,7 +448,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
if reqdata, err := json.Marshal(textRequest); err != nil {
|
||||
fmt.Printf("[ERROR] marshal relay text error: %s\n", err.Error())
|
||||
} else {
|
||||
fmt.Printf("[ERROR] send req %q got error %d\n", string(reqdata), resp.StatusCode)
|
||||
if respdata, err := io.ReadAll(resp.Body); err != nil {
|
||||
fmt.Printf("[ERROR] read resp body error: %s\n", err.Error())
|
||||
} else {
|
||||
resp.Body = io.NopCloser(bytes.NewBuffer(respdata))
|
||||
|
||||
fmt.Printf("[ERROR] send req %q to %s got error [%d]%s\n",
|
||||
string(reqdata), req.URL.String(), resp.StatusCode, string(respdata))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user