Repository navigation
fix(settings): Anthropic 兼容供应商的模型可设置输入能力 - #1120
Merged
Merged
Conversation
K-brain 按模型条目的 inputModalities/vision 判定能否收图,与 API 类型无关; 前端推送、modelFactory 与模型选择器也都不区分供应商。唯一缺口是设置页的 providerSupportsModelInputModalitiesOverride 把 claude_code 排除在外, Anthropic 兼容供应商因此无法开启图片输入。放开该门控,并补推送/读回测试。
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.
Closes #1045
问题
Anthropic 兼容供应商(
claude_code)的模型编辑面板只有 Context Window / Max Output Token,没有「输入能力」选项,无法为目录外的视觉模型开启图片输入。原因与修复
v2 的运行时链路本身已与供应商类型无关:
modelFactory对所有供应商应用inputModalities,providerSettings把它同步给 K-brain(Vision),K-brain 的视觉判定和 Anthropic 图片块构造也不区分 API 类型。唯一的阻断是设置界面的开关providerSupportsModelInputModalitiesOverride(providerUtils.ts)未包含claude_code,因此下拉框被隐藏,模型列表的模态图标也忽略已保存的覆盖值。providerUtils.ts:放开claude_code。test/settings/input-modalities.test.mjs更新断言;新增test/providers/kbrain-attachment-read.test.mjs用例,验证 Anthropic 兼容的目录外模型带用户覆盖时以api: "anthropic-messages"+["text","image"]同步给 K-brain,并能从 K-brain 读回。验证
pnpm typecheck:ui、biome 通过。Screenshots / preview
在浏览器中渲染真实的
ProviderModal(Anthropic 兼容供应商 + 目录外模型vision-model-x),打开模型参数: