添加gpts
This commit is contained in:
parent
202c900897
commit
d1ef53e89f
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,4 +9,5 @@ logs
|
||||
data
|
||||
/web/node_modules
|
||||
/.history
|
||||
|
||||
cmd.md
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user