添加gpts

This commit is contained in:
liuchunk 2024-05-08 20:19:27 +08:00
parent 202c900897
commit d1ef53e89f
2 changed files with 12 additions and 3 deletions

1
.gitignore vendored
View File

@ -9,4 +9,5 @@ logs
data
/web/node_modules
/.history
cmd.md

View File

@ -2,13 +2,15 @@ package middleware
import (
"fmt"
"net/http"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/songquanpeng/one-api/common/ctxkey"
"github.com/songquanpeng/one-api/common/logger"
"github.com/songquanpeng/one-api/model"
"github.com/songquanpeng/one-api/relay/channeltype"
"net/http"
"strconv"
)
type ModelRequest struct {
@ -39,9 +41,15 @@ func Distribute() func(c *gin.Context) {
return
}
} else {
requestModel = c.GetString(ctxkey.RequestModel)
var err error
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, requestModel, false)
if strings.HasPrefix(requestModel, "gpt-4-gizmo") {
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, "gpt-4-gizmo", false)
} else {
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, requestModel, false)
}
if err != nil {
message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, requestModel)
if channel != nil {