fix: improve error messages for channel retrieval failures in distributor and relay

This commit is contained in:
CaIon
2025-07-23 16:32:52 +08:00
parent e0b859dbbe
commit 756a8c50d6
3 changed files with 6 additions and 9 deletions

View File

@@ -107,7 +107,7 @@ func Distribute() func(c *gin.Context) {
if userGroup == "auto" {
showGroup = fmt.Sprintf("auto(%s)", selectGroup)
}
message := fmt.Sprintf("当前分组 %s 下对于模型 %s 可用渠道", showGroup, modelRequest.Model)
message := fmt.Sprintf("获取分组 %s 下模型 %s 可用渠道失败distributor: %s", showGroup, modelRequest.Model, err.Error())
// 如果错误,但是渠道不为空,说明是数据库一致性问题
if channel != nil {
common.SysError(fmt.Sprintf("渠道不存在:%d", channel.Id))
@@ -118,7 +118,7 @@ func Distribute() func(c *gin.Context) {
return
}
if channel == nil {
abortWithOpenAiMessage(c, http.StatusServiceUnavailable, fmt.Sprintf("当前分组 %s 下对于模型 %s 可用渠道(数据库一致性已被破坏)", userGroup, modelRequest.Model))
abortWithOpenAiMessage(c, http.StatusServiceUnavailable, fmt.Sprintf("分组 %s 下模型 %s 可用渠道不存在(数据库一致性已被破坏distributor", userGroup, modelRequest.Model))
return
}
}