fix: fix channel panic

This commit is contained in:
CaIon 2024-01-10 00:17:03 +08:00
parent 4a4df75830
commit 3e13810ca2

View File

@ -108,6 +108,10 @@ func Distribute() func(c *gin.Context) {
abortWithMessage(c, http.StatusServiceUnavailable, message) abortWithMessage(c, http.StatusServiceUnavailable, message)
return return
} }
if channel == nil {
abortWithMessage(c, http.StatusServiceUnavailable, fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道(数据库一致性已被破坏)", userGroup, modelRequest.Model))
return
}
} }
c.Set("channel", channel.Type) c.Set("channel", channel.Type)
c.Set("channel_id", channel.Id) c.Set("channel_id", channel.Id)