Skip to content
dsh.fish
Bundle

dsh-model-switcher

Visual custom-provider presets and model switching for DeepSeek Harness Web.

Source
jianjianzhu
License
MIT
Updated
Updated 16 days ago

Readme

# dsh-model-switcher

[![CI](https://github.com/jianjianzhu/dsh-model-switcher/actions/workflows/ci.yml/badge.svg)](https://github.com/jianjianzhu/dsh-model-switcher/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/dsh-model-switcher.svg)](https://www.npmjs.com/package/dsh-model-switcher)

DeepSeek Harness Web 的可视化自定义模型管理插件。它在 **插件 → 模型切换器** 中提供 Provider 预设、API Key 安全写入、模型发现和默认模型切换,无需手工编辑 `settings.yaml`。

界面面向普通用户设计:选择服务商、填写密钥、获取模型、选择默认模型并保存即可;协议、地址和兼容参数默认收纳在高级设置中。

## 当前功能

- NyroAPI/SAPI、标准 OpenAI 兼容、OpenRouter 和自定义预设
- DeepSeek、SiliconFlow、Gemini、Anthropic、Ollama、LM Studio、vLLM 和 LiteLLM 预设
- 编辑 Provider ID、名称、基础地址和 API 协议
- API Key 写入 Harness credentials 存储,不写入普通 settings
- 调用 Harness 模型发现接口测试连接,通过搜索和勾选导入模型
- 保留服务商返回的模型名称、上下文长度、最大输出和输入类型
- 读取并编辑已有 Provider,支持重命名和删除
- 保留已有 Provider 的凭据引用,并允许目录型 Provider 继承内置 API 地址
- 自动清理误填的 `/models`、`/chat/completions`、`/responses`、`/messages` 路径
- 针对认证、权限、地址、超时、TLS 和网络错误提供中文诊断
- 支持安全的自定义请求头;敏感鉴权头不会在界面显示
- 可视化调整 Developer Role、finish_reason、流式 usage 和 Token 上限字段
- 导入和导出不含 API Key、Authorization、Cookie 等敏感信息的 Provider 模板
- 保存多个模型,并可将第一个模型设为默认模型
- NyroAPI 预设自动设置 `supportsFinishReason: false`、`supportsDeveloperRole: false` 和 `maxTokensField: max_tokens`

## 本地安装

在本目录运行:

```powershell
node tests/smoke.mjs
dsh plugin --profile web add .
```

如果使用源码 checkout 启动 Harness:

```powershell
node D:\deepseek-harness\apps\cli\lib\bin.js plugin --profile web add .
```

安装完成后打开 Harness 的 **插件** 页面,选择 **模型切换器**。

## 开发与构建

`src/client.js` 是浏览器端源码,`lib/client.js` 是随 npm 包发布的可复现产物。

```powershell
npm run build
npm run build:check
npm test
npm pack --dry-run
```

## 安全说明

API Key 通过 Harness `credentials` Remote 写入凭据存储。插件不会把明文密钥写入 `settings.yaml`、日志或导出配置。

## 限制

- 当前版本仅面向 Web profile。
- 连接测试使用服务商的模型发现端点;不提供模型列表的网关仍可手动填写模型 ID。
- Azure 等需要专用协议或非标准模型发现地址的服务仍需后续适配。

Install

dsh plugin --profile web add github:jianjianzhu/dsh-model-switcher

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source