mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-21 01:36:37 +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++ {
|
for i := 0; i <= common.RetryTimes; i++ {
|
||||||
channel, err := getChannel(c, group, originalModel, i)
|
channel, err := getChannel(c, group, originalModel, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.LogError(c, fmt.Sprintf("Failed to get channel: %s", err.Error()))
|
errMsg := fmt.Sprintf("获取渠道出错: %s", err.Error())
|
||||||
break
|
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)
|
openaiErr = relayRequest(c, relayMode, channel)
|
||||||
|
Loading…
Reference in New Issue
Block a user