fix(config): 过滤聊天候选中的非聊天模型#3487
Merged
esengine merged 1 commit intoJun 8, 2026
Merged
Conversation
esengine
approved these changes
Jun 8, 2026
esengine
left a comment
Owner
There was a problem hiding this comment.
过滤逻辑清晰,ChatModelList 包装不改 ModelList 原语义,测试覆盖到位。合入。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概述
修复 #3483。
TTS/STT/ASR 等非聊天模型会出现在 Desktop 和 CLI 的聊天模型候选列表中。用户误选这类模型作为聊天模型后,请求仍按 Chat messages 格式发送,可能触发 Provider 400 错误,例如:
messages[0] system role is not allowed for TTS model本 PR 在共享配置层新增聊天模型候选过滤,避免非聊天模型进入 Desktop / Settings / CLI 的聊天模型选择路径。
改动内容
config.IsLikelyChatModel(),使用通用 token-based heuristic 过滤明显非聊天模型ProviderEntry.ChatModelList(),保留ModelList()原始语义不变ChatModelList()ChatModelList()/model列表改用ChatModelList()/modelTab 补全改用ChatModelList()modelListText()改用ChatModelList()设计说明
ModelList()仍然返回 provider 原始模型列表,用于配置保存、诊断、模型解析、迁移等内部路径。ChatModelList()只用于聊天模型候选展示路径,避免前端局部过滤导致 Desktop 和 CLI 行为不一致。Known limitation
如果用户历史配置中已经把默认模型设置为 TTS/ASR 等非聊天模型,
DefaultModel()仍可能解析到该模型。这个属于已有坏配置的回退问题,建议后续单独 follow-up 处理,避免本 PR 扩大到模型解析和配置迁移逻辑。验证
git diff --check通过go test ./internal/config/ -v通过go test ./desktop/ -run "TestProviderViewFromEntry|TestSaveProvider|TestWithFresh" -v通过go test ./internal/control/通过/model列表不再显示 TTS/ASR 模型/modelTab 补全不再显示 TTS/ASR 模型Fixes #3483