fix: custom 渠道视觉助手误匹配同名文本模型 - #1677
Closed
aixuxing wants to merge 4 commits into
Closed
Conversation
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.
问题
当视觉助手配置的渠道为
custom时,resolvePiVisionRelayRoute会退回全 Pi catalog 按modelId(再按name兜底)匹配。由于custom没有专属 catalog provider,会遍历所有 provider,同名不同源的纯文本模型(如 HuggingFace 的 MiMo-V2.5)会抢在视觉版之前命中,导致input不含image,最终误报"不支持图片输入"。修复
custom渠道的视觉能力由用户在视觉助手配置中显式声明(channelId+modelId)。这里直接信任用户配置,对provider === 'custom'提前返回{ adapterProvider: provider },不再退回全 catalog 按模型名兜底匹配。若用户配置了非多模态模型,上游调用会失败,现有错误处理会返回
VISION_PROVIDER_ERROR并携带具体原因。改动
apps/electron/src/main/lib/adapters/pi-model-registry.ts:custom 视觉路由提前返回,信任用户配置