From eaee89f77acd1cb8de5612f7b3ae8b964301e485 Mon Sep 17 00:00:00 2001 From: CaIon Date: Wed, 23 Jul 2025 16:46:06 +0800 Subject: [PATCH] fix(distributor): add validation for model name in channel selection --- middleware/distributor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/middleware/distributor.go b/middleware/distributor.go index 48c05209..3c529a41 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -100,6 +100,10 @@ func Distribute() func(c *gin.Context) { } if shouldSelectChannel { + if modelRequest.Model == "" { + abortWithOpenAiMessage(c, http.StatusBadRequest, "未指定模型名称,模型名称不能为空") + return + } var selectGroup string channel, selectGroup, err = model.CacheGetRandomSatisfiedChannel(c, userGroup, modelRequest.Model, 0) if err != nil {