适配6.12
This commit is contained in:
parent
eba6fb0a53
commit
82f4808f01
@ -3,9 +3,10 @@ package common
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const KeyRequestBody = "key_request_body"
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/songquanpeng/one-api/common"
|
||||
@ -21,8 +20,6 @@ import (
|
||||
"github.com/songquanpeng/one-api/relay/util"
|
||||
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
)
|
||||
|
||||
// https://platform.openai.com/docs/api-reference/chat
|
||||
@ -122,6 +119,7 @@ func shouldRetry(c *gin.Context, statusCode int) bool {
|
||||
}
|
||||
|
||||
func processChannelRelayError(ctx context.Context, channelId int, channelName string, err *model.ErrorWithStatusCode) {
|
||||
|
||||
logger.Errorf(ctx, "relay error (channel #%d): %s", channelId, err.Message)
|
||||
// https://platform.openai.com/docs/guides/error-codes/api-errors
|
||||
if util.ShouldDisableChannel(&err.Error, err.StatusCode) {
|
||||
|
@ -69,9 +69,9 @@ func Distribute() func(c *gin.Context) {
|
||||
}
|
||||
|
||||
if strings.HasPrefix(modelRequest.Model, "gpt-4-gizmo") {
|
||||
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, "gpt-4-gizmo")
|
||||
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, "gpt-4-gizmo",false)
|
||||
} else {
|
||||
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model)
|
||||
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model,false)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user