condaThinker/dsh-image-inline ↗★ 0
dsh-image-inline
Let the model render an image into the DSH web chat flow (QQ/WeChat style) via a show_image tool: the message content keeps only the path text, the image never enters model context, and the browser shows the picture inline, scrollable with history.
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:condaThinker/dsh-image-inline说明文档
阅读完整 README ↗dsh-image-inline
让 DeepSeek Harness (DSH) 的 Web UI 支持模型主动把一张图片渲染进对话流(QQ/微信聊天式:图片显示在会话里、可上翻、和对话同步)。
对话流消息内容里只保留路径文本,图片本身不进入模型上下文(模型上下文保持干净,纯文本模型路由不受影响)。
工作方式
模型调用新增的 show_image 工具(传入磁盘图片路径)时:
- host(
dsh/index.js):校验路径/格式/大小 → 读取字节 → 通过附件服务saveImage存成内容寻址附件 → 返回纯文本结果(路径 + 元数据摘要)。图片的展示载荷(attachmentId/宽高/字节数)通过工具的presentationMeta放进tool/result事件的meta字段——不进模型上下文、不进会话日志的 image 块。 - client(
dsh/client.js):注册tool.call.toolview键控槽位(key =show_image),在对话流中该工具调用的位置渲染图片卡片(复用官方MessageImage组件:缩略图、点击看原图、加载失败可重试)。图片 URL 走插件自己的内容寻址 HTTP 端点。
模型 → show_image(path) → 附件服务存图 → 纯文本结果(路径+摘要)
│
├─ tool/result meta ─→ client toolview 渲染图片卡片
└─ 注册表($DSH_HOME/plugins/dsh-image-inline/registry.json)
└─ GET /plugin/show-image/ → 图片字节
为什么需要插件自己的 HTTP 端点?
DSH 内置的 conversation.resolveImage → session.attachment RPC 只服务"会话日志的 image 块里被引用的附件"(api-proxy 的 referencedImage 授权)。本插件的结果故意不包含 image 块(否则图片会进入模型上下文),因此附件永远不会被日志引用,必须由插件自己提供读取通道。
安全性:attachmentId 是 sha256: 内容哈希——内容寻址 capability URL,不知道图片内容就无法猜测;id 只出现在用户可读的会话日志与插件注册表中。服务默认绑定 loopback,与整个 Web UI 同一信任模型。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:condaThinker/dsh-image-inline
sudo systemctl restart dsh # 或按你的方式重启 web profile
本插件零构建(纯 JS),GitHub 直接分发源码,安装时无需执行任何构建脚本。
卸载:
npx -p @deepseek-ai/dsh dsh plugin --profile web remove dsh-image-inline
sudo systemctl restart dsh
配置
cordis.patch.yml 中的 config(可覆盖):
| 键 | 默认 | 说明 |
|---|---|---|
maxImageBytes | 26214400 (25MiB) | 单张图片编码字节上限(实际生效值 = min(本配置, 附件服务配置)) |
maxImagePixels | (40MP) |