fix(llm): 显式 chat 能力标签,媒体模型可同时声明对话能力 - #329
Merged
Merged
Conversation
根因:判定「是否聊天模型」依赖「capabilities 为空」反推,导致声明了 imageGeneration 等媒体能力的模型被聊天选择器排除,二者不可兼得。 qwen-image-2.1 因此被误排除;反过来若被绑定则每轮对话都打 /v1/chat/completions 并 404 中断会话。 改动: - 新增 model-capabilities.ts 作为规则唯一权威实现: 聊天能力 = capabilities 含 'chat' || (无媒体标签 && mode 非媒体) - web-ui 侧新增 modelCapabilities.ts 镜像(bundle 不能 import core) - router.ts 两处旧反推改用新谓词 - settings.ts:llm_add_model 的 enum 与文档补 'chat' - ChatModelMenu / ModelRoutingSection:聊天选择器与文本路由共用新规则 - api-server.ts:能力建议同步 - 新增 model-capabilities.test.ts(7 用例) 向后兼容:未声明 capabilities 的老数据行为不变。
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.
背景
rc.0 发布后追加的修复。根因:判定「是否聊天模型」靠「capabilities 为空」反推,导致声明了 imageGeneration 等媒体能力的模型被聊天选择器排除 —— 二者不可兼得(qwen-image-2.1 因此被误排除;反过来若被绑定则每轮对话都打
/v1/chat/completions并 404 中断会话)。改动
packages/core/src/llm/model-capabilities.ts作为规则唯一权威实现:聊天能力 =capabilities含chat||(无媒体标签 && mode 非媒体)modelCapabilities.ts镜像(bundle 不能 import core)router.ts两处旧反推改用新谓词settings.ts:llm_add_model的 enum 与文档补chatChatModelMenu/ModelRoutingSection:聊天选择器与文本路由共用新规则api-server.ts:能力建议同步model-capabilities.test.ts(7 用例,本地已通过)兼容性
未声明
capabilities的老数据行为不变。验证
npx vitest run packages/core/test/model-capabilities.test.ts→ 7/7 passed