mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-20 17:26:38 +08:00
chore: 优化relay代码
This commit is contained in:
parent
8a9ff36fbf
commit
fbe6cd75b1
@ -47,8 +47,14 @@ func Relay(c *gin.Context) {
|
||||
for i := 0; i <= common.RetryTimes; i++ {
|
||||
channel, err := getChannel(c, group, originalModel, i)
|
||||
if err != nil {
|
||||
common.LogError(c, fmt.Sprintf("Failed to get channel: %s", err.Error()))
|
||||
break
|
||||
errMsg := fmt.Sprintf("获取渠道出错: %s", err.Error())
|
||||
common.LogError(c, errMsg)
|
||||
openaiErr = service.OpenAIErrorWrapperLocal(err, "get_channel_failed", http.StatusInternalServerError)
|
||||
openaiErr.Error.Message = common.MessageWithRequestId(errMsg, requestId)
|
||||
c.JSON(openaiErr.StatusCode, gin.H{
|
||||
"error": openaiErr.Error,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
openaiErr = relayRequest(c, relayMode, channel)
|
||||
|
Loading…
Reference in New Issue
Block a user