fix(adapters): enable image input for deepseek vision models - #1029
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 13 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. WalkthroughDeepSeek 客户端现在检测模型的图片输入支持,并动态更新模型能力列表。创建聊天模型时,客户端同时注入按模型生成的 OpenAI 文件处理配置。 ChangesDeepSeek 客户端能力支持
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change enables image handling for supported DeepSeek vision models while retaining existing model and file-type limits; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- fileHandlingConfig moved to utils.ts with DeepSeek-supported MIME types (JPEG/PNG/GIF/WebP, no BMP) and official size limits (32MiB per image, 48MiB per request) per https://api-docs.deepseek.com/guides/vision
问题
通过 deepseek 适配器使用官方 API 的视觉模型(如
deepseek-v4-flash-vision-exp,官方 API 实测支持识图)时,ChatLuna 仍然无法识别图片。原因
adapter-deepseek/src/client.ts的refreshModels()给所有 LLM 模型的 capabilities 只授予了ToolCall,从未授予ImageInput。即使模型名带vision(supportImageInput('deepseek-v4-flash-vision-exp')本应返回 true),模型能力里也没有image_input,导致:read_chat_message中间件里modelInfoSupportsElement判定图片不支持,图片元素被替换为[image:<hash>]文本占位符,模型根本收不到图片;fileHandlingConfig(允许的图片 MIME 类型)。对比 openai-like 适配器,它用
supportImageInput(model)决定是否授予ImageInput。修复
参照 openai-like 适配器的做法:
ImageInput(通过共享的supportImageInput(model)判定,含vision关键字的模型自动获得图像输入能力);_createModel传入fileHandlingConfig: getOpenAIFileHandlingConfig(model)。变更
packages/adapter-deepseek/src/client.ts: 为视觉模型授予 ImageInput capability 并补充 fileHandlingConfig