Merge remote-tracking branch 'songquanpeng/main'

# Conflicts:
#	controller/relay-text.go
#	middleware/distributor.go
This commit is contained in:
quzard
2023-06-20 20:15:57 +08:00
22 changed files with 245 additions and 46 deletions

View File

@@ -17,7 +17,7 @@ type ModelRequest struct {
func Distribute() func(c *gin.Context) {
return func(c *gin.Context) {
userId := c.GetInt("id")
userGroup, _ := model.GetUserGroup(userId)
userGroup, _ := model.CacheGetUserGroup(userId)
c.Set("group", userGroup)
var channel *model.Channel
channelId, ok := c.Get("channelId")
@@ -76,7 +76,7 @@ func Distribute() func(c *gin.Context) {
if strings.HasPrefix(modelRequest.Model, "gpt-35-turbo") {
modelRequest.Model = strings.Replace(modelRequest.Model, "gpt-35-turbo", "gpt-3.5-turbo", 1)
}
channel, err = model.GetRandomSatisfiedChannel(userGroup, modelRequest.Model)
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model)
if err != nil {
c.JSON(200, gin.H{
"error": gin.H{