添加gpts
This commit is contained in:
parent
202c900897
commit
d1ef53e89f
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,4 +9,5 @@ logs
|
|||||||
data
|
data
|
||||||
/web/node_modules
|
/web/node_modules
|
||||||
/.history
|
/.history
|
||||||
|
|
||||||
cmd.md
|
cmd.md
|
||||||
|
@ -2,13 +2,15 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/songquanpeng/one-api/common/ctxkey"
|
"github.com/songquanpeng/one-api/common/ctxkey"
|
||||||
"github.com/songquanpeng/one-api/common/logger"
|
"github.com/songquanpeng/one-api/common/logger"
|
||||||
"github.com/songquanpeng/one-api/model"
|
"github.com/songquanpeng/one-api/model"
|
||||||
"github.com/songquanpeng/one-api/relay/channeltype"
|
"github.com/songquanpeng/one-api/relay/channeltype"
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelRequest struct {
|
type ModelRequest struct {
|
||||||
@ -39,9 +41,15 @@ func Distribute() func(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
requestModel = c.GetString(ctxkey.RequestModel)
|
requestModel = c.GetString(ctxkey.RequestModel)
|
||||||
var err error
|
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 {
|
if err != nil {
|
||||||
message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, requestModel)
|
message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, requestModel)
|
||||||
if channel != nil {
|
if channel != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user