ReiRui/dsh-image-preview ↗★ 0

dsh-image-preview

Local image hosting for DeepSeek Harness: serves images from a preview directory over the web profile's own HTTP server so chat messages can render them inline, plus a preview_image tool that stages an existing local image and returns its URL. 适合需要让 AI 将生成的本地图片快速生成 URL 并直接在聊天框中展示的用户。

Package
dsh-image-preview
Compatibility
Unverified
Version
0.1.0
License
MIT
Last updated
Aug 17, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ReiRui/dsh-image-preview

配置

在 $DSH_HOME/profiles/web/cordis.patch.yml 里覆盖该行的 config:

- id: image-preview
  config:
    root: !!js dshHomePath('preview')   # 预览目录,可改成项目目录
    prefix: /preview                    # URL 前缀

使用

  1. 让 AI 生成/下载一张图(截图、渲染预览等)到本地;
  2. AI 调用 preview_image 工具传入绝对路径;
  3. 工具返回 http://127.0.0.1:3080/preview/,AI 在回复里贴该链接;
  4. 页面内联显示图片。

也可以直接访问 http://127.0.0.1:3080/preview/ 查看。

AI 使用提示(给 agent 的约定)

  • 必须调用 preview_image 工具,禁止手动把文件复制进 ~/.dsh/preview:新会话的文件沙箱默认是 workspace-write,AI 的文件工具写不进预览目录(会报"目录出错")。工具内部不受该沙箱限制。
  • 工具返回的 url 字段是唯一有效的 URL,AI 应原样内嵌(![alt](https://github.com/ReiRui/dsh-image-preview/blob/a1a81c5420ad3559678deba37b85785e4e47fb5d/url)),不要自行拼接或猜文件名。
  • 通过工具复制的文件名为 8位随机-原名(如 7faf2295-theme-gallery.png),这是与手动复制区分的特征。
  • 工具返回 ok:false 时,把 error 原样报告给用户(文件不存在 / 类型不支持等)。