dsh-image-understanding
by rison114514
deepseek-harness 原生插件:让纯文本模型(如 DeepSeek)经 agent/pre-step 劫持 + resolveModelInfo 包装自动识别上传图片(qwen-vl)
安装
dsh plugin --profile web add github:rison114514/dsh-image-understandingGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
让 deepseek-harness (dsh) 里的纯文本模型(如 DeepSeek)也能"看见"你上传的图片 —— 自动调用阿里云百炼 qwen-vl 把图片转成文字描述再喂给模型,全程对模型透明,无需切换多模态模型。
配套说明:本插件是 deepseek-vision(WorkBuddy 钩子版)在 deepseek-harness 上的原生插件重写版。两者核心差别见文末「与 deepseek-vision 的差别」。
原理(两道闸都堵上)
deepseek-harness 对纯文本模型有两道图片拦截:
- Gate 1 — 提交校验:
apiproxy在消息含图时查模型inputModalities,DeepSeek 是['text'],直接报错"当前模型不支持图片"。 - Gate 2 — 序列化校验:
serialize.ts的assertTextOnly对 image block 无条件拒绝。
本插件在插件层同时解决,不碰 harness 源码:
- 包装
ctx.llm.resolveModelInfo,让 deepseek 系纯文本模型"声称"支持 image,骗过 Gate 1; - 在
agent/pre-stepseam(serialize 之前)把ImageBlock经attachments.readImage()取字节 → 百炼qwen-vl识别 → 替换为【图片识别】…文本块,DeepSeek 全程只见纯文本(Gate 2); - 仅模拟 deepseek 系纯文本模型;真·视觉模型原样透传,不被二次转换。
另外注册了一个显式 tool image_understanding,可手动按图片路径或 data URL 调用。
前置条件
- 已本地安装并构建 deepseek-harness(能跑
pnpm dsh web) - 一个阿里云百炼 API Key(OpenAI 兼容模式,申请:https://bailian.console.aliyun.com/ )
安装
# 一行安装(从 GitHub 以 DSH bundle 形式装入指定 profile)
dsh plugin --profile web add github:rison114514/dsh-image-understanding
装好后启动 web:dsh web(或 pnpm dsh web)。
使用
开 新会话 → 选择 DeepSeek 主模型 → 直接拖入 / 上传图片并输入"描述这张图" → 预期:
- 不再弹出"当前模型不支持图片"
- 图片被 qwen-vl 自动识别为文字描述并回填,DeepSeek 据此作答
也可在对话中显式调用 image_understanding 工具,传入图片本地绝对路径(或 data URL)做按需识别。
配置项(Web UI:设置 → 插件 → 插件配置 → image-understanding)
启动后在网页端「设置」→「插件」→「插件配置」里找到 image-understanding 卡片,按需填写并保存(改动即时生效,无需重启):
| 字段 | 说明 | 默认 |
|---|---|---|
api_key |
阿里云百炼 API Key(sk-...),必填;页面以只写输入框呈现,明文不会回传 |
— |
model |
视觉模型 ID | qwen3-vl-flash |
base_url |
OpenAI 兼容接口地址 | https://dashscope.aliyuncs.com/compatible-mode/v1 |
timeout |
单次调用超时(秒) | 20 |
想直接改文件也行:对应
$DSH_HOME/settings.yaml里的image-understanding:小节,字段同上。
与 deepseek-vision 的差别
| 维度 | deepseek-vision(旧) | dsh-image-understanding(本插件) |
|---|---|---|
| 宿主 | WorkBuddy,靠 UserPromptSubmit 钩子外部进程 |
deepseek-harness,cordis 原生插件 |
| 图片获取 | 钩子读 stdin 的 transcript_path jsonl 取真实路径 |
直接用 harness 内部 attachments.readImage() 取字节 |
| 注入方式 | 识别结果写 additionalContext 注入 |
pre-step 改写消息 + resolveModelInfo 包装骗过能力校验 |
| 安装 | install.sh 改 settings.json 后重启 |
pnpm dsh web --patch cordis.patch.yml 热加载 |
| 额外能力 | 支持 SVG(Chrome headless 渲染) | 多注册了显式 image_understanding tool,支持图片路径 / data URL 按需识别 |
一句话核心差别:旧版是"在 WorkBuddy 外部挂一个钩子进程去拦截消息",新版是"在 deepseek-harness 内部作为原生插件、从消息序列化之前就接管图片"——更内聚、无外部进程依赖、不依赖解析 stdin 的隐式字段。
已知限制
- 仅对 deepseek 系纯文本模型自动生效;其他模型需本身支持图片或不会被模拟。
- 单图识别失败会降级为
【图片识别失败】…文本,不阻断对话。 - 拖放 / 上传图片受 harness 附件通道限制,仅支持 jpg/png/webp/gif;SVG、PDF 等非常规格式暂未做预处理。
原始 README: https://github.com/rison114514/dsh-image-understanding/blob/main/README.md ↗
同类插件
查看全部 →
agent-vision-toolkit
为纯文本模型"看图“设计更好的视觉工具箱和技能,支持多图理解,图片问答,前端UI还原、GUI 自动化等,并可选无缝接入多个主流agent,直接识别粘贴图片| A vision toolkit and skill designed for text-only llms — image Q&A, long-screenshot OCR, frontend UI restoration, and GUI automation, with optional seamless integration for Codex, Claude Code, Pi, Oh My Pi, and OpenCode

api-relay-audit
从 DeepSeek Harness 对 AI API 中转站和 LLM 代理运行本地安全审计,生成 Markdown 报告,覆盖提示词注入、模型替换信号、工具调用改写、错误泄漏、流完整性和按 profile 启用的 Web3 风险。

OpenStory
✨ OpenStory 现已支持 DeepSeek Harness 插件! 现在可以通过 dsh-openstory 将 OpenStory 多智能体推演接入 DeepSeek Harness,让 agent 直接启动模拟、查看角色、下达指令并逐回合推进故事。查看 DSH 插件配置与使用指南。

phi
pi的编码代理 ∞ 提供者、子代理、hashline编辑和权限门

anysearch-dsh
DeepSeek Harness(DSH)的 AnySearch 网络搜索提供方与高级搜索工具。

codex-switch
Codex Switch 是一个 macOS 工具,一键配置 Codex 的自定义 API,同时保留官方 OpenAI 登录。保存后 Codex 的模型选择器里只会出现你选的那个 provider 的模型。也支持 Claude Code 的官方 / 自定义 API 切换。Codex Switch is a lightweight helper for configuring multiple coding-agent API routes. For Codex, it keeps Official OpenAI and a custom API provider configured in parallel, registers the custom model in Codex's mod