xingling80/dsh-zhipu-vision ↗★ 1
dsh-zhipu-vision
Zhipu (智谱) GLM-4V vision understanding for DSH: agent tool zhipu_vision (local image path or URL + prompt) calls the Zhipu vision API and returns the model answer; paste-to-identify UX — pasting an image into the chat composer saves it on the host and inserts the recognition instruction into the composer through the official conversation input face, so you type your own question after it and send once; the text-only chat model (DeepSeek) answers via the tool. A sidebar 视觉 panel with image+question combo send (sessions driver, same as the task board), a saved-image gallery, and a plugin config card in the GUI settings. Hot-pluggable — mounted via the web profile cordis.patch.yml + a profile node_modules copy, no dsh source changes.
AI 分析
核心用途是利用智谱大模型为DSH引入免费或高性能的视觉理解能力。适合需要便捷识图、截图分析功能的DSH用户。
インストール
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:xingling80/dsh-zhipu-visionドキュメント
README 全文を読む ↗配置
插件不内置任何 API Key。配置方式(优先级从高到低):GUI 设置卡片 → 配置文件
~/.dsh/dsh-zhipu-vision.json → 环境变量 DSH_ZHIPU_API_KEY。
| 字段 | 默认值 | 说明 |
|---|---|---|
apiKey | 无(留空) | 智谱 API Key(Bearer);设置页只写不回显 |
model | glm-4v-flash | 视觉模型(免费)/ glm-4v-plus / glm-4.1v-thinking |
baseUrl | https://open.bigmodel.cn/api/paas/v4 | 接口地址 |
timeoutMs | 60000 | 请求超时(毫秒) |
maxImageBytes | 10485760 (10MB) | 本地图片大小上限 |
interceptPaste | true | 聊天框图片粘贴拦截 |
autoSendOnPaste | false | 粘贴后自动发送识别请求(默认插入输入框等你输入需求) |
keepPastesDays | 7 | 已保存图片保留天数(0=永久) |
announceToAgent / enabled | true | 通告 / 总开关(需重载完全生效) |
2) 冒烟测试:真实调用智谱 API 识别 test-image.png(需已配置 API Key)
$env:DSH_ZHIPU_API_KEY = (Get-Content "$HOME.dsh\dsh-zhipu-vision.json" -Raw | ConvertFrom-Json).apiKey node ".\smoke-test.mjs"
## 安全模型
- **请勿把真实 API Key 提交到公开仓库**——本插件不内置 Key(默认值为空),避免泄露导致
额度被盗用或 Key 被平台自动失效
- 图片会上传至智谱开放平台(open.bigmodel.cn)推理,敏感图片请勿使用
- API Key 明文存于 `~/.dsh/dsh-zhipu-vision.json`(与 dsh-ssh 同信任模型);配置 GET 只返回
「已设置」标志,Key 永不进入浏览器
- 所有路由仅限 loopback 访问(含同源校验);`paste-file` 有文件名白名单与路径穿越防护
- 粘贴的图片保存在 `~/.dsh/pastes/`(默认 7 天自动清理,可手动清空)
## 常见问题(FAQ)
| 现象 | 原因 / 处理 |
| --- | --- |
| 粘贴图片没反应 | 检查设置卡片「粘贴拦截」是否开启;确认焦点在聊天输入框而非侧边栏面板 |
| 粘贴后输入框没有出现「识别这张图片」 | `autoSendOnPaste` 开启时会直接自动发送;关闭(默认)才会插入输入框 |
| 报「Zhipu API key is not configured」 | 设置卡片或 `~/.dsh/dsh-zhipu-vision.json` 里未填 API Key |
| 报「image file not found」 | 传入的图片路径不存在或不是绝对路径;粘贴保存的图片在 `~/.dsh/pastes/` |
| 插件入口没出现 | 安装后需重启应用;确认 profile `package.json` 的 bundles 含 `dsh-zhipu-vision` |
| 双击桌面脚本报「不是内部或外部命令」 | 旧版脚本的编码问题;请使用当前随插件配套的 ASCII 版脚本 |
## 已知限制
- 单张图片/单次请求(`glm-4v-flash` 不支持多图)
- 自动发送在当前会话进行(sessions driver 通道);若无可用会话则退回剪贴板模式
- `announceToAgent` / `enabled` 改动需重载完全生效
- 调用消耗智谱 API 额度(`glm-4v-flash` 免费)