npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lijian-ui/dsh-vision-toggle

v0.2.1

Published

Per-model vision (image input) toggle for DeepSeek Harness (dsh): list every configured model and flip a switch to enable/disable image support without hand-editing settings.yaml. 为 DeepSeek Harness 提供按模型的「支持图片」开关:无需手改 settings.yaml。

Downloads

792

Readme

dsh-vision-toggle · 模型视觉能力开关插件

English | 中文

为 DeepSeek Harness (dsh) 提供模型视觉开关:让用户自主控制每个配置的模型是否支持图片输入——拨动开关即可按模型开启/关闭视觉能力,无需手改配置文件、无需重启。web 端与官方桌面端均可使用。

功能概览

| 功能 | 说明 | |---|---| | 模型列表 | 读取 llm-pi-ai provider 路由中声明的所有模型,按 provider 分组展示 | | 视觉开关 | 逐模型切换图片输入:开启为 ['text','image'],关闭为 ['text'] | | 即时生效 | 写入官方配置,llm-pi-ai 检测到变化后重新注册,无需重启即可生效 | | 乐观更新 | 开关立即切换;若 host 写入失败则自动回滚 | | 国际化 | 中英双语,跟随 dsh 客户端语言设置 |

背景

dsh 官方已支持多模态(图片理解),内置 deepseek-v4-vision-exp 模型。但设置页无法配置自定义 provider / 第三方模型的输入模态(input)。如果你添加自己的 provider(如通过 LM Studio / vLLM / Ollama 提供的 OpenAI 兼容服务),即便其模型实际支持视觉,发送图片仍会报:

当前模型不支持图片

目前唯一的绕法是手动编辑 settings.yaml,给对应模型加上 input: [text, image]——既脆弱又易出错。

本插件消除了这个摩擦点:它操作官方 llm-pi-ai 设置命名空间,在设置页为每个模型提供一个「支持图片」开关,拨动开关即可替你把模型的 input 模态写好。

安装

前置条件

  • DeepSeek Harness (dsh) >= 0.1.6-alpha.2:web 端(dsh web)或官方桌面端
  • Node.js >= 18

安装到 web 端

dsh plugin --profile web add @lijian-ui/dsh-vision-toggle

然后重启客户端(dsh web)。--profile 是必填项——不加会直接报错。

安装到桌面端

CLI 会刻意拒绝操作 desktop profile(error: profile "desktop" is managed exclusively by the Electron application),所以要在桌面应用内安装:

  1. 打开桌面端 → 桌面插件
  2. 在包名输入框填入 @lijian-ui/dsh-vision-toggle,点 安装
  3. 重启桌面端

profile 之间相互隔离。 每个 profile(web、desktop …)都有自己独立的 node_modules,位于 $DSH_HOME/profiles/<name>。装到其中一个,不会让插件在另一个里出现。

本地开发

# 克隆并进入插件仓库
git clone https://github.com/lijian-ui/dsh-vision-toggle.git
cd dsh-vision-toggle

# 安装依赖
npm install

# 构建
npm run build

# 监听模式
npm run watch

# 类型检查
npm run typecheck

构建产物在 lib/ 目录下。每次构建后需重启客户端加载新 bundle。

使用方式

  1. 打开 dsh(web 端或桌面端)
  2. 进入 设置 → 模型视觉能力(位于其他设置分节之后)
  3. 该分节列出所有已配置模型,按 provider 分组,每个模型右侧有一个「支持图片」开关:
    • 开启:模型可接收图片输入,聊天时即可发送图片
    • 关闭:模型为纯文本

拨动开关只是把该模型的 input 设为 ['text','image'] 或 ['text'],正好命中 dsh 判断「模型是否支持图片」的逻辑。

技术架构

目录结构

dsh-vision-toggle/
├── src/
│   ├── index.ts                    # Host 端入口(注册 remote 服务 + typert 契约)
│   ├── remote.ts                   # Host 端 RPC:listModels / setVision(读写 llm-pi-ai 配置)
│   └── client/
│       ├── index.ts                # Client 端入口(SECTION_ID、RPC 注册、inject)
│       ├── VisionToggleSection.ts  # 设置页组件(按 provider 分组的模型列表 + 开关)
│       └── client-i18n.ts          # 客户端国际化(中/英)
├── lib/                            # 构建产物(index.js + client.js)
├── package.json
├── tsdown.config.ts
└── cordis.patch.yml

Host 端(src/remote.ts)

提供以下 RPC 方法:

| 方法 | 功能 | |---|---| | listModels() | 列出所有 providers[*].models 中声明的模型,含当前 input 模态与是否支持视觉 | | setVision(provider, modelId, enabled) | 将指定模型的 input 改写为 ['text','image'](开)或 ['text'](关)并持久化 |

配置读写

插件操作的是 官方 llm-pi-ai 设置命名空间(settingsNamespace('llm-pi-ai'),由 @deepseek-ai/dsh-llm-pi-ai 拥有)——正是支撑模型选择与「当前模型不支持图片」错误的那份配置:

  • 读:settings.get('llm-pi-ai') 返回 provider 路由;在已移除 get 的 dsh 版本上会回退到 settings.describe('llm-pi-ai')。每个模型的实际 input 缺省时回退到 provider 的 defaultInput。
  • 写:使用 settings.update('llm-pi-ai', { providers: ... }) 并传入重建的完整 models 数组。因为基于路径操作的 settings.mutate API 无法定位数组索引(会把整个数组替换掉),所以这里改为重建数组。

由于 llm-pi-ai 每次请求都会解析 input 并在配置变化时重新注册,因此拨动开关即时生效,无需重启。

开关机制

用户点击开关
  → client 乐观更新该行(立即切换状态)
  → RPC 调用 host 端 setVision(provider, modelId, enabled)
  → host: 读取配置,重建 models[],settings.update('llm-pi-ai', …)
  → llm-pi-ai 检测到变化并重新注册模型路由
  → 配置写入 settings.yaml;下一条消息即按新模态处理

若 host 写入失败,client 会恢复开关原状并提示错误。

国际化

支持中文和英文两种语言,翻译文件在 src/client/client-i18n.ts 中。语言切换跟随 dsh 客户端的语言设置。

技术栈

  • 语言:TypeScript
  • 构建:tsdown (rolldown)
  • 前端:React 18
  • RPC:@deepseek-ai/dsh-typert-protocol / @deepseek-ai/dsh-typert-registry(host remote)
  • 配置:@deepseek-ai/dsh-settings(命名空间 llm-pi-ai)

许可证

MIT

相关链接