|
在模型自己使用工具读取图片时,出现如下问题: 如何解决? |
Replies: 3 comments
|
这条报错是路由能力声明的判定,不是模型本身调用失败 —— 所以「配置了 deepseek-flash」和「能不能读图」是两个开关,得分开看。 报错从哪来
const routed = exec.agent?.session.requestHeader()?.config
const provider = routed?.provider ?? exec.agent?.options.provider
const model = routed?.model ?? exec.agent?.options.model
const active = await llm.resolveModelInfo(provider, model, exec.signal)
if (active.inputModalities === undefined || !active.inputModalities.includes('image')) {
throw new Error(`cannot read "${requestedPath}" as an image: model "${model}" does not declare image input; …`)
}对 const configured = connection.models.find(entry => entry.id === model)
...
...configured === undefined
? { provider, id: model, name: model, inputModalities: ['text'] } // 未登记的 model id 一律当纯文本
: modelInfo(provider, configured),注意最后那个分支的注释:目录里没登记的 model id 会被刻意当成纯文本,因为声明一个未经验证的图片能力,会让宿主把后续每一轮都可能被端点拒绝的输入持久化下来。 关键点:出厂目录里
|
|
已解决 |
|
你这条建议和你在 #6422 发的 Ideas 是同一件事 —— 我已在那边回复:inputModalities 在设置 UI 里没有任何可编辑入口(packages/client/* 零命中),这是已实测的真实缺口。两条可以合并给官方跟进。 |
这条报错是路由能力声明的判定,不是模型本身调用失败 —— 所以「配置了 deepseek-flash」和「能不能读图」是两个开关,得分开看。
报错从哪来
packages/fs/tool-fs/src/read-image.ts:119-131:read_image会解析当前会话的活动路由,要求该路由的inputModalities显式包含image:对
deepseek-official这条路由,inputModalities来自适配器的目录条目(pack…