xuxun-oss/dsh-vision-imagen
DeepSeek Harness all-in-one: no model switching — regular DeepSeek auto-routes to vision & image gen. Multi-backend: Gemini + any OpenAI-compatible (GPT-4o, Qwen-VL, GLM-4V, gpt-image, DALL-E, Flux, OpenRouter). gemini_vision/gemini_generate_image/gemini_optimize_image with vision self-check. Better than modlens.
项目介绍Project Overview
dsh-vision-imagen 是 DeepSeek Harness 插件,为纯文本 DeepSeek 模型桥接 Google Gemini 等多模态后端,提供 vision_read 看图/OCR、generate_image 文生图、edit_image 改图三项工具,并在生成后用视觉模型自检、不达标自动重绘。适合在同一会话中需要识图、生图、改图且不想手动切换模型时使用。需自备 Gemini 或 OpenAI 兼容后端 API Key,且依赖 dsh ≥0.1.0-rc.7 与 Node.js ≥18。
dsh-vision-imagen is a DeepSeek Harness plugin that bridges text-only DeepSeek models to Google Gemini and other multimodal backends. It provides vision_read for image/OCR analysis, generate_image for text-to-image, and edit_image for image editing, with automatic visual self-check and redraw after generation. Use it when a single DeepSeek session needs to view, create, or modify images without switching models. It requires your own Gemini or OpenAI-compatible API key, dsh ≥0.1.0-rc.7, and Node.js ≥18.
请帮我了解并安装插件:【dsh-vision-imagen】【https://github.com/xuxun-oss/dsh-vision-imagen】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add dsh-vision-imagen
把 xuxun-oss/dsh-vision-imagen 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-vision-imagen
DeepSeek Harness 插件:为 DeepSeek 模型桥接 Google Gemini 的多模态识别与图像生成。
当 DeepSeek 模型需要看图、生图、改图时,自动调用 Gemini:
| 工具 | 作用 |
|---|---|
vision_read |
识别/读取/描述/分析图片(OCR、物体、图表),支持本地路径或 http(s) URL |
generate_image |
文本生图,生成后必定用 Gemini 视觉模型自检反馈(不达标时按优化 prompt 重绘) |
edit_image |
改图/优化已有图片:先分析原图 → 生成改进版 → 自检迭代 |
✨ 核心卖点:全能一体,无需切换模型
- 一个 DeepSeek 会话搞定一切:直接用常规 DeepSeek 模型(不必换成视觉模型),需要看图、生图、改图时,插件自动路由到对应的 Gemini 多模态/生图模型——全程零手动切换模型。
- 比 modlens 等更完整:modlens 只是「给纯文本模型装一只读图的眼睛」;本插件是视觉识别 + 图像生成 + 图像编辑 + 自检反馈的完整闭环,并且直接复用你自己的 Gemini API Key,不依赖任何第三方桥接、无额外订阅。
- 自动调用,无需操心:识别 →
vision_read;生图 →generate_image;改图 →edit_image。DeepSeek 模型通过系统提示与工具描述自动选对工具,对用户完全透明。 - 自检闭环,质量把关:生成/优化后,自动用 Gemini 视觉模型检查成品图,不达标按优化提示自动重绘,并把检查结论(画面描述 / 达标与否 / 问题清单)直接反馈出来。
🧩 环境要求(依赖)
| 依赖 | 要求 | 说明 |
|---|---|---|
DeepSeek Harness(dsh) |
≥ 0.1.0-rc.7(rc 通道) |
插件宿主。先全局安装 dsh,再用 dsh plugin --profile web add ... 加载本插件 |
| Node.js | ≥ 18 | 宿主半运行环境(engines) |
@deepseek-ai/dsh-tools |
peer 依赖(*) |
必需:宿主半通过 defineTool 注册工具。由 dsh 宿主提供,或随 pnpm install 自动解析——无需手动安装 |
react |
^18.2.0(peer) | 浏览器半(设置页)所需,由 dsh Web 前端提供 |
@deepseek-ai/dsh-client-runtime |
rc 通道 | 客户端核心服务,声明于 dsh.client.inject,dsh Web 构建时自动注入 |
| 后端 API Key | 自备 | Gemini(Google AI Studio 免费 Key)或所选 OpenAI 兼容后端 |
本插件运行时只依赖
@deepseek-ai/dsh-tools(宿主半)与react(浏览器半),其余均为 Node.js 内置模块;@deepseek-ai/*其余包由 dsh 宿主自带,不会重复安装。已实测:dsh0.1.0-rc.7+@deepseek-ai/dsh-tools@0.1.0-rc.7可正常解析运行。
📦 安装
🚀 本插件已发布到 npm(
dsh-vision-imagen),推荐直接安装:
方式一:npm 安装(推荐)
npm i -g dsh-vision-imagen # 或 dsh plugin --profile web add dsh-vision-imagen
等价的一行安装:
dsh plugin --profile web add dsh-vision-imagen
方式二:本地目录(开发/试用)
git clone https://github.com/xuxun-oss/dsh-vision-imagen.git
dsh plugin --profile web add /path/to/dsh-vision-imagen
# 然后重启 dsh web(或按 dsh 的插件热载提示操作)
安装后打开 设置 → Vision Imagen,填入 Google AI Studio 的 API Key,点「测试连接」即可。
💡 获取 Gemini API Key:https://aistudio.google.com/apikey(免费额度即可)。
🔌 多后端支持(不止 Gemini)
通过 provider 抽象层适配不同后端,同一个 DeepSeek 会话、无需切换模型:
| 后端 | 视觉识别/自检 | 图像生成 | 兼容平台示例 |
|---|---|---|---|
gemini(默认) |
gemini-3.7-flash、gemini-3.6-flash、gemini-2.5-pro… |
gemini-3.1-flash-lite-image(Nano Banana 2 Lite)、gemini-3.1-flash-image(Nano Banana 2)、gemini-3-pro-image(Nano Banana Pro)、imagen-4.0-generate-001 |
Google AI Studio(免费 Key) |
openai(OpenAI 兼容) |
gpt-4o、gpt-4o-mini、gpt-4.1、qwen-vl-max、qwen2.5-vl-72b、glm-4v-plus、glm-4v-flash、moonshot-v1-vision、minimax-vl、internvl、deepseek-vl2* |
gpt-image-1、dall-e-3、flux-1.1-pro、flux-schnell、stable-diffusion、sd3.5-large、ideogram、recraft、hunyuan-image、seedream* |
OpenAI / OpenRouter / 智谱 GLM / 阿里云百炼 Qwen / Moonshot Kimi / MiniMax / 硅基流动 SiliconFlow / 各类中转与自建网关 |
* 经 OpenAI 兼容端点/聚合平台提供。
设置页「后端 Provider」下拉切换;端点、模型列表、鉴权头(x-goog-api-key / Bearer)自动适配。换后端只需填对应的 API Key 与端点,工具调用方式完全不变——任何提供 OpenAI 兼容 /chat/completions(视觉)与 /images/generations、/images/edits(生图/编辑)的服务均可接入。
🎯 模型自动选择(auto)
- 识别/自检:
gemini-3.7-flash→gemini-3.6-flash→gemini-3.1-flash-lite→gemini-2.5-flash - 生图:
gemini-3.1-flash-lite-image(Nano Banana 2 Lite)→gemini-3.1-flash-image(Nano Banana 2)→gemini-3-pro-image(Nano Banana Pro)→gemini-2.5-flash-image→imagen-4.0-generate-001
设置页可下拉选择任意官方模型,或输入自定义模型名;模型不可用时自动沿链降级。
⚙️ 说明
- 配置(含 API Key)保存在
~/.dsh/vision-imagen.json。 - 生成后自动用 Gemini 视觉模型检查成品图并给出反馈(闭环,不依赖 modlens)。
- 图片保存在
~/.dsh/vision-imagen-images/,工具结果卡片内联显示图片并提供可点击链接/api/vision-imagen/images/<file>。 - 仅走 原生 Gemini REST API(
generateContent/predict),端点勿加/openai。
❓ FAQ
Q: 为什么生成图后还要"自检"? A: 生成式模型偶尔会跑偏(缺手、多指、文字错误等)。插件每轮生成后都用视觉模型核对画面与你的要求是否一致,不达标自动按优化提示重绘,直到满意或达到轮数上限。
Q: 必须用 Gemini 吗? A: 不是。默认后端是 Gemini(免费 Key 即可),但通过 OpenAI 兼容后端可接入 GPT-4o、Qwen-VL、GLM-4V、gpt-image、DALL-E、Flux、Stable Diffusion 等几十种模型/平台。
Q: 我的 API Key 安全吗?
A: Key 只保存在本机 ~/.dsh/vision-imagen.json,插件仅在调用后端 API 时使用,不会上传到任何第三方。设置页只回显 Key 的后 4 位。
Q: 图片保存在哪里?
A: ~/.dsh/vision-imagen-images/,同时通过附件机制入库,可在会话中直接查看。
🔒 安全
- API Key 仅存本机,且设置页回显时脱敏(只显示后 4 位)。
- 插件的 HTTP 路由(
/api/vision-imagen/*)只允许本机回环地址访问(非 loopback 请求返回 403)。 - 请勿把
~/.dsh/vision-imagen.json提交到任何版本库。
🤝 贡献
欢迎提 Issue 与 PR:
- 报告 Bug / 建议新模型 → Issues
- 修改代码 → Fork 后提交 PR,CI 会自动做语法检查
- 完善文档 → README 中英双语的修正同样欢迎
📄 目录
lib/index.js 宿主半:三个工具 + systemPrompt 引导 + 配置/模型 HTTP 路由
lib/client.js 浏览器半:设置页(settings.section)
cordis.patch.yml 组合 patch(insert 行)
package.json 包元数据(dsh.bundle / dsh.client)
📜 更新日志
见 CHANGELOG.md。
⚖️ License
MIT © Xun Xu (xuxun-oss)
nexu-io/open-design
freestylefly/awesome-gpt-image-2
anywhere-labs/dsh-desktop
walkinglabs/learn-harness-engineering
awesome-dsh-plugin/awesome-dsh-plugin
MemTensor/MemOS