fix(model): fallback to ratio-formatted model name #2559
+19
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR 类型
PR 是否包含破坏性更新?
PR 描述
当
MEMORY_CACHE_ENABLED=false时(不知道为什么有人会搞成false),middleware/distributor.go的分发流程在选择可用 channel 时会依赖model.GetChannel的数据库查询结果。此时如果请求的model名称需要通过setting/ratio_setting/model_ratio.go的FormatMatchingModelName做匹配/归一化,原始查询可能返回空结果,从而导致分发失败。本 PR 在
model/ability.go的GetChannel中增加兜底逻辑:当首次查询返回空(或失败)时,使用FormatMatchingModelName(model)的结果再查询一次;仅当兜底查询成功时才覆盖原结果/错误,避免掩盖真实错误。这样即使关闭内存缓存,也能正确匹配到按 ratio 设置归一化后的模型名并完成分发。Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.