dsh-image-plugins:为 DeepSeek Harness 接入看图与生图

前言

DeepSeek Harness(DSH)通过插件扩展能力。如果要在 DSH 的 web profile 中使用图片理解或图片生成,需要先接入相应的模型端点。

下面介绍 dsh-image-plugins。它为 DeepSeek Harness 提供两类多模态能力:理解工作区中的图片文件,并根据提示词生成图片。这两个能力都通过可配置的 OpenAI-compatible 或 DashScope 端点完成。

这是什么

alanzhao0128/dsh-image-plugins 是一个 DeepSeek Harness 多模态插件,由 alanzhao0128 维护,采用 MIT 许可证。

它提供两个核心能力:

  • understand_image:读取工作区图片文件,发送到可配置的视觉端点,并返回模型的文字描述。
  • generate_image:根据提示词生成图片,保存到工作区并返回保存路径。

插件的 visionimage 配置块相互独立。未配置时,对应能力不启用;未配置安装保持 inert and safe。

核心功能

understand_image

understand_image 是一个 model tool。它会读取工作区中的图片文件,把图片发送到配置的视觉端点,并返回模型生成的文字描述。

这个能力适合在文本流程中讨论截图、图表、界面截图或其他工作区图片。

generate_image

generate_image 也是一个 model tool。它根据提示词调用图片生成端点,把生成结果保存到工作区,并返回保存路径。

在默认示例中,生成图片保存到 generated/

DashScope 图片生成

插件支持任意 OpenAI-compatible 端点,并支持可选的 DashScope provider,用于调用 native Model Studio API。

需要注意:DashScope compatible-mode 不提供 images/generations,会返回 404。因此使用 DashScope 做图片生成时,需要使用 provider: dashscope 的 native Model Studio API。

安装与启用

安装

使用官方安装命令:

dsh plugin --profile web add dsh-image-plugins

安装后重启 dsh web,或重启对应 profile 进程。

启用能力

插件安装后并不会自动启用能力,需要先配置端点和密钥。

自 0.2.0 起,插件提供 Web settings panel:

Settings → 图片插件 / Image Plugins

在这个面板中,可以编辑 visionimage 两个配置块,并通过官方 credential store 管理对应密钥。

也可以手动配置。在 profile 的 cordis.patch.yml 中覆盖 id: image-plugins 行,并设置 visionimagebaseUrlapiKeymodel 等配置。

一个基础配置示例:

- id: image-plugins
  name: dsh-image-plugins
  config:
    vision:
      baseUrl: 'https://your-vision-endpoint.example.com/v1'
      apiKey: 'sk-...'
      model: 'your-vision-model'
    image:
      baseUrl: 'https://your-image-endpoint.example.com/v1'
      apiKey: 'sk-...'
      model: 'your-image-model'

如果只需要看图,可以只配置 vision。如果只需要生图,可以只配置 image。两个配置块相互独立。

配置与密钥

配置块独立

visionimage 是独立配置块。每个 config block 可以单独启用,也可以一起启用。

部分填写会 fail the load loudly。例如只写了 baseUrl,但没有写 apiKey,加载会明显失败。

apiKey 支持的写法

apiKey 支持三种形式:

'sk-...'
env:VARNAME
cred:NAME

其中 cred:NAME 会在每次请求时通过宿主 credential seam 解析。

密钥不会进入 session log 或 tool results。

端点要求

端点必须 OpenAI-compatible。

视觉理解使用:

POST {baseUrl}/chat/completions

并要求端点接受 image_url data URL。

图片生成使用:

POST {baseUrl}/images/generations

并要求端点返回:

data[0].b64_json

或:

data[0].url

DashScope 配置注意

DashScope compatible-mode 不提供 images/generations,会返回 404。

如果要做 DashScope 图片生成,需要使用 provider: dashscope 的 native Model Studio API。

典型用法

看图

在 workspace 中输入:

Look at `images/screenshot.png` and tell me what it shows.

插件会读取该图片文件,调用配置的视觉端点,并返回模型的文字描述。

生图

在 workspace 中输入:

Generate an image of a red apple on a wooden table.

插件会调用图片生成端点,保存图片到工作区,并返回保存路径。示例中保存目录为 generated/

图生图

图生图需要 DashScope provider。示例提示词:

Change the color of `images/logo.png` to blue.

适用场景与注意

适合谁

这个插件适合以下场景:

  • 需要在 DSH web profile 中理解工作区图片。
  • 需要基于提示词生成图片,并把结果保存回工作区。
  • 希望视觉端点和图片生成端点分开配置。
  • 希望密钥不进入 session log 或 tool results。
  • 希望未配置时插件保持 inert and safe。

安全与许可证

包内不携带 API keys,每个用户自行配置。

插件以当前 dsh 进程权限运行。安装前应先检查源码与许可证。

许可证为 MIT。

其他注意

  • Auto-understand (V2) 已实现,但默认关闭,未经 live session 验证,不属于 supported surface。
  • 从 GitHub 安装时,如果环境是 pnpm ≥ 10,需要先允许构建脚本,然后重新 add。
  • npm 与 tarball 安装无需该允许。

pnpm allowBuilds 配置示例:

allowBuilds:
  dsh-image-plugins: true

结尾

dsh-image-plugins 把图片理解和图片生成接入了 DSH 插件体系:看图能力返回文字描述,生图能力返回工作区保存路径。两个能力独立配置,密钥通过 credential 机制处理,未配置时不会启用。

相关链接:

  • 目录页:https://www.skillhub.cn/plugins/alanzhao0128/dsh-image-plugins
  • GitHub:https://github.com/alanzhao0128/dsh-image-plugins
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜