
DSH Image Modlens Bridge
☆ 0DSH plugin: for text-only model routes, save uploaded images under .dsh_images and analyze them via modlens (external vision provider), replacing the image block with text evidence.
Get this plugin
Review the source, then continue to the publisher.
About this plugin
Source snapshot 8/15/2026dsh-image-modlens-bridge
A DeepSeek Harness plugin that lets text-only model routes "see" user-uploaded images. When a user uploads an image in a session whose model does not declare image input, the plugin intercepts it at agent/pre-step, saves the image to <cwd>/.dsh_images/, runs the external vision provider modlens, and replaces the image block with text evidence (summary + OCR + layout + semantics) before the message is persisted. The model request therefore never carries an image, while the model can still reason over the image content.
给纯文本模型路由用的图片桥接插件:用户上传图片时,在 agent/pre-step 拦截,把图片落盘到会话工作目录下的 .dsh_images/,调用 modlens 外部视觉通道识别,再把图片 block 替换为文本证据(summary + OCR 全文 + 版面 + 语义),因此模型请求里永远不会携带图片——纯文本模型也能"看到"图片内容。
Requires a working modlens setup (e.g. the modlens skill's
run.ps1/run.shlauncher, or a modlens CLI on PATH). Vision-capable model routes are never touched — they keep the native image path.
Features / 特性
- Text-only routes only: gate on
resolveModelInfo().inputModalities; routes that declareimageinput pass through untouched. - Clean interception point:
agent/pre-stepruns before the loop persists decision messages, so neither durable history nor the request ever contains the image block. - Fail-open by contract: modlens failure, attachment read failure, or any plugin exception degrades to an explanatory text block (with the saved path when available). A request is never blocked because of the bridge.
- Zero runtime dependencies: only Node built-ins; the modlens launcher is spawned as an external process.
- 只对声明不支持 image 输入的模型路由生效;视觉模型路由保持原生图片路径,不做任何干预。
- 拦截点在
agent/pre-step(step 1):决策消息在此被持久化进 session,替换发生在持久化之前,历史与请求都不含图片 block。 - modlens 分析失败或附件读取失败时 fail-open:替换为说明性文本(含保存路径),绝不让请求因插件失败而卡死。
Install / 安装
# 1. clone anywhere (an ASCII path avoids Windows CJK-path issues)
git clone https://github.com/wendou-chen/dsh_image-modlens-bridge.git
# e.g. move to C:\Users\admin\.codex\dsh-image-modlens-bridge\
- Add the dependency to your profile's
package.json:
{
"dependencies": {
"dsh-image-modlens-bridge": "file:C:/Users/admin/.codex/dsh-image-modlens-bridge"
}
}
- In the profile directory (e.g.
C:\Users\admin\.dsh\profiles\web), install:
pnpm install
- Register the plugin in the profile's
cordis.patch.yml:
- insert:
- id: image-modlens-bridge
name: 'dsh-image-modlens-bridge'
- Restart DeepSeek Harness (plugins load at startup).
Config / 配置(profile cordis.patch.yml 的 config 字段)
| Field | Default | Meaning |
|---|---|---|
enabled | true | false 整体关闭 |
launcher | C:\Users\admin\.agents\skills\modlens\scripts\run.ps1 | modlens 启动器路径(env MODLENS_LAUNCHER 优先) |
saveDirName | .dsh_images | 保存目录名,位于会话工作目录下 |
modlensTimeoutMs | 180000 | modlens 超时(毫秒) |
Usage / 使用
- Start a session with a text-only model (e.g.
deepseek-v4-flash). - Upload an image in the composer.
- The plugin automatically:
- saves the image to
<cwd>/.dsh_images/upload-<timestamp>-<id>.<ext> - runs modlens against it (external vision provider)
- feeds the model the text evidence instead of the image
- saves the image to
- The model answers based on the vision evidence.
验证:上传后检查 <cwd>/.dsh_images/ 是否出现图片文件;模型回复应引用图片内容(摘要/OCR 文本等),而不是提示"无法查看图片"。
Troubleshooting / 排查
- 图片没有保存、模型仍说看不到:确认重启了 DSH;确认模型路由确实不声明
image(视觉模型不会被插件处理);看 DSH 日志是否有插件报错。 - modlens 分析失败:单独运行启动器验证:
powershell -ExecutionPolicy Bypass -File <launcher> -i <image>,检查 modlens 配置(modlens config show/doctor)。 - 想恢复原生行为:
config.enabled: false或移除 patch 条目。
License
MIT © 2026 wendou-chen. See LICENSE.