From 0115d1d194a085ccac3f56d43f707e6b72606c44 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Sat, 9 Sep 2023 04:29:00 +0800 Subject: [PATCH] fix bug --- middleware/distributor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/middleware/distributor.go b/middleware/distributor.go index d862e9d2..e5788b1f 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -60,6 +60,7 @@ func Distribute() func(c *gin.Context) { // Select a channel for the user var modelRequest ModelRequest if strings.HasPrefix(c.Request.URL.Path, "/mj") { + // Midjourney if modelRequest.Model == "" { modelRequest.Model = "midjourney" } @@ -97,7 +98,8 @@ func Distribute() func(c *gin.Context) { modelRequest.Model = "whisper-1" } } - channel, err := model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model) + var err error + channel, err = model.CacheGetRandomSatisfiedChannel(userGroup, modelRequest.Model) if err != nil { message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", userGroup, modelRequest.Model) if channel != nil { @@ -114,6 +116,7 @@ func Distribute() func(c *gin.Context) { return } } + //log.Printf("Using channel %v", channel) c.Set("channel", channel.Type) c.Set("channel_id", channel.Id) c.Set("channel_name", channel.Name)