Skip to content

fix(adapters): enable image input for deepseek vision models - #1029

Merged
dingyi222666 merged 2 commits into
v1-devfrom
fix/deepseek-vision
Aug 28, 2026
Merged

dingyi222666 merged 2 commits into
v1-devfrom
fix/deepseek-vision

Conversation

@dingyi222666

Copy link
Copy Markdown
Member

问题

通过 deepseek 适配器使用官方 API 的视觉模型(如 deepseek-v4-flash-vision-exp,官方 API 实测支持识图)时,ChatLuna 仍然无法识别图片。

原因

adapter-deepseek/src/client.tsrefreshModels() 给所有 LLM 模型的 capabilities 只授予了 ToolCall从未授予 ImageInput。即使模型名带 visionsupportImageInput('deepseek-v4-flash-vision-exp') 本应返回 true),模型能力里也没有 image_input,导致:

  1. read_chat_message 中间件里 modelInfoSupportsElement 判定图片不支持,图片元素被替换为 [image:<hash>] 文本占位符,模型根本收不到图片;
  2. 模型层缺少 fileHandlingConfig(允许的图片 MIME 类型)。

对比 openai-like 适配器,它用 supportImageInput(model) 决定是否授予 ImageInput

修复

参照 openai-like 适配器的做法:

  • capabilities 增加 ImageInput(通过共享的 supportImageInput(model) 判定,含 vision 关键字的模型自动获得图像输入能力);
  • _createModel 传入 fileHandlingConfig: getOpenAIFileHandlingConfig(model)

变更

  • packages/adapter-deepseek/src/client.ts: 为视觉模型授予 ImageInput capability 并补充 fileHandlingConfig

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 13 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83226ef3-20c2-4074-a6da-39ba7d48e17f

📥 Commits

Reviewing files that changed from the base of the PR and between a39db29 and 313845e.

📒 Files selected for processing (2)
  • packages/adapter-deepseek/src/client.ts
  • packages/adapter-deepseek/src/utils.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 85ff2b3b-a762-4f4d-a368-be2ee2f426aa

📥 Commits

Reviewing files that changed from the base of the PR and between 2e12acf and a39db29.

📒 Files selected for processing (1)
  • packages/adapter-deepseek/src/client.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


Walkthrough

DeepSeek 客户端现在检测模型的图片输入支持,并动态更新模型能力列表。创建聊天模型时,客户端同时注入按模型生成的 OpenAI 文件处理配置。

Changes

DeepSeek 客户端能力支持

Layer / File(s) Summary
模型能力与文件处理配置
packages/adapter-deepseek/src/client.ts
客户端导入共享适配器。模型支持图片输入时,能力列表加入 ImageInput。创建聊天模型时,注入 OpenAI 文件处理配置。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a39db

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

小兔捧来新配置
深Seek 看见图片光
文件随模型入场
工具能力仍在岗
代码轻跳过月亮

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了主要变更,即为 DeepSeek 视觉模型启用图片输入。
Description check ✅ Passed 描述与变更内容一致,说明了图片输入能力和文件处理配置的修复原因及实现方式。
Docstring Coverage ✅ Passed 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…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deepseek-vision

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- 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
@dingyi222666
dingyi222666 merged commit ce09bae into v1-dev Aug 28, 2026
5 checks passed
@dingyi222666
dingyi222666 deleted the fix/deepseek-vision branch August 28, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant