소스 검색

fix(distributor): add validation for model name in channel selection

CaIon 8 달 전
부모
커밋
eaee89f77a
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      middleware/distributor.go

+ 4 - 0
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 {