mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 17:46:37 +08:00
refactor: Improve performance and reliability in text relay functionality
- Refactor relay-text controller to improve performance and readability - Update function signatures for better consistency - Optimize error handling for improved reliability
This commit is contained in:
parent
287376dd97
commit
da6d7874ee
@ -15,6 +15,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -443,6 +444,15 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
}
|
||||
}(c.Request.Context())
|
||||
}
|
||||
|
||||
{ // more error info
|
||||
if reqdata, err := json.Marshal(req); err != nil {
|
||||
fmt.Printf("relay text error: %s\n", err.Error())
|
||||
} else {
|
||||
fmt.Printf("send req %q got error %d", reqdata, resp.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
return relayErrorHandler(resp)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user