refactor: Optimize code performance across multiple files

- Optimize performance in relay-text functionality
- Refactored code for better readability and maintainability
- Fixed a bug causing intermittent crashes
- Improved error handling for edge cases
- Updated documentation for relay-text module
This commit is contained in:
Laisky.Cai 2023-12-18 03:29:35 +00:00
parent e86bc68f07
commit e382322445

View File

@ -445,10 +445,10 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
}
{ // more error info
if reqdata, err := json.Marshal(req); err != nil {
fmt.Printf("relay text error: %s\n", err.Error())
if reqdata, err := json.Marshal(textRequest); err != nil {
fmt.Printf("[ERROR] marshal relay text error: %s\n", err.Error())
} else {
fmt.Printf("send req %q got error %d", reqdata, resp.StatusCode)
fmt.Printf("[ERROR] send req %q got error %d\n", string(reqdata), resp.StatusCode)
}
}