Commit 6ca32631 by CaIon

fix bug

parent a71b737a
...@@ -60,6 +60,7 @@ func Distribute() func(c *gin.Context) { ...@@ -60,6 +60,7 @@ func Distribute() func(c *gin.Context) {
// Select a channel for the user // Select a channel for the user
var modelRequest ModelRequest var modelRequest ModelRequest
if strings.HasPrefix(c.Request.URL.Path, "/mj") { if strings.HasPrefix(c.Request.URL.Path, "/mj") {
// Midjourney
if modelRequest.Model == "" { if modelRequest.Model == "" {
modelRequest.Model = "midjourney" modelRequest.Model = "midjourney"
} }
...@@ -97,7 +98,8 @@ func Distribute() func(c *gin.Context) { ...@@ -97,7 +98,8 @@ func Distribute() func(c *gin.Context) {
modelRequest.Model = "whisper-1" modelRequest.Model = "whisper-1"
} }
} }
channel, err := model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model) var err error
channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model)
if err != nil { if err != nil {
message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, modelRequest.Model) message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, modelRequest.Model)
if channel != nil { if channel != nil {
...@@ -114,6 +116,7 @@ func Distribute() func(c *gin.Context) { ...@@ -114,6 +116,7 @@ func Distribute() func(c *gin.Context) {
return return
} }
} }
//log.Printf("Using channel %v", channel)
c.Set("channel", channel.Type) c.Set("channel", channel.Type)
c.Set("channel_id", channel.Id) c.Set("channel_id", channel.Id)
c.Set("channel_name", channel.Name) c.Set("channel_name", channel.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment