dsh-plugin-model-provider
DeepSeek Harness plugin — append the provider/platform name after the model name in the chat input area.
中文
功能
在 DeepSeek Harness 的对话界面中,模型名后面追加该模型所属平台的名称。
生效范围:
| 位置 | 效果 |
|---|---|
| 输入框上方的模型按钮 | DeepSeek-V4.1-Flash(DeepSeek 账号) |
| 弹层「模型」行 | DeepSeek-V4.1-Flash(DeepSeek 账号) |
| 下拉候选列表每一项 | 保持原样,不带平台名 |
平台名用次要文字色、略小字号显示,不影响模型名的主视觉。
0.0.2 起改为纯 DOM 装饰,不再复刻官方 1017 徽标逻辑(该徽标已在较新的 DSH 宿主中移除)。
截图示例
弹层:
模型 DeepSeek-V4-Flash(Trae 企业版) ›
推理等级 high ›
输入框上方按钮:
[DeepSeek-V4-Flash(Trae 企业版) ▾]
下拉候选列表:
DeepSeek-V4-Flash ← 不带平台名
gpt-6-sol
kimi-k3
安装
方式一:file 依赖(本地开发)
- 将本目录放到你的工作区或任意位置。
- 在你的 DSH profile 目录(通常为
~/.dsh/profiles/desktop/)下编辑package.json:{ "dependencies": { "dsh-plugin-model-provider": "file:/path/to/dsh-plugin-model-provider" }, "dsh": { "profile": { "bundles": ["dsh-plugin-model-provider"] } } } - 在 profile 的
cordis.patch.yml末尾追加:# 本地插件:在「模型」行与输入框上方的模型按钮里,模型名后追加平台名。 - insert: - id: ui-model-provider-label name: 'dsh-plugin-model-provider' - 将插件复制到
~/.dsh/profiles/desktop/node_modules/dsh-plugin-model-provider/。 - 重启 DeepSeek Harness。
方式二:dsh plugin add(如果可用)
dsh plugin add /path/to/dsh-plugin-model-provider
注意:某些 DSH 版本的
dsh plugin add存在文件锁问题(EPERM onpackage.json.lock),此时请使用方式一手动安装。
工作原理
0.0.2 起采用纯 DOM 装饰,不注册任何插槽。原因:dsh-codex-subscription 等插件会抢占 conversation.input.model 这个 single 插槽却不声明 conversation.input.model.label 子插槽,导致基于 slots.inject 的注册根本不会执行;且该子插槽是 single,多个连接器会互相竞争。
- 包装
Response.prototype.json/text,从宿主自身的/api/session/modelCatalog响应里学习「模型 → 平台」映射(宿主连接层会缓存fetch引用,包装fetch无效)。 - 打开模型菜单时,从分组标题与候选项文本补充学习,作为兜底。
- 用 CSS
::after+data-mp-platform属性给「输入框上方模型按钮」与弹层「模型」行追加平台名,不改 React 子节点,因此不会被 re-render 清掉;下拉候选列表保持原样。 - 平台名自动去除尾部括号限定词以避免双层括号,匹配时兼容
Hy4 · x0.29这类倍率后缀。
代价:依赖 .codexModelSelect* 这组 DOM 类名,宿主大改版时需同步调整选择器。
兼容性
- DeepSeek Harness >= 0.2.1-rc.3
- React ^18.2.0
- 仅 Web 平台(
dsh.client.platform: "web")
文件说明
| 文件 | 说明 |
|---|---|
package.json |
插件清单 |
cordis.patch.yml |
bundle patch 声明 |
lib/index.js |
服务端入口(空 apply) |
lib/client.js |
浏览器侧组件(渲染逻辑) |
回退
删除 node_modules/dsh-plugin-model-provider/,从 profile package.json 的 dependencies 和 dsh.profile.bundles 移除本插件,删掉 cordis.patch.yml 末尾的 insert 段,重启即可恢复。
编码说明
所有文件使用 无 BOM 的 UTF-8 编码。DSH 的 resolveMeta() 使用 JSON.parse(readFileSync(path, "utf8")) 读取 package.json,不去 BOM,带 BOM 会报 SyntaxError: Unexpected token '\uFEFF'。这与官方所有插件保持一致。
License
MIT
English
What it does
Appends the provider/platform name after the model name in the DeepSeek Harness chat input area.
Where it takes effect:
| Location | Result |
|---|---|
| Model button above the input box | DeepSeek-V4.1-Flash(DeepSeek 账号) |
| "Model" row in the popup menu | DeepSeek-V4.1-Flash(DeepSeek 账号) |
| Each item in the dropdown candidate list | Unchanged — no platform name |
The platform name is rendered in a muted caption color at a slightly smaller font size.
Since 0.0.2 the plugin uses plain DOM decoration; it no longer replicates the official "1017" badge (removed from newer DSH hosts).
Example
Popup menu:
Model DeepSeek-V4-Flash(Trae 企业版) ›
Effort high ›
Input trigger button:
[DeepSeek-V4-Flash(Trae 企业版) ▾]
Dropdown candidates:
DeepSeek-V4-Flash ← no platform name
gpt-6-sol
kimi-k3
Installation
Option 1: file dependency (local dev)
- Place this directory in your workspace or anywhere on disk.
- In your DSH profile directory (typically
~/.dsh/profiles/desktop/), editpackage.json:{ "dependencies": { "dsh-plugin-model-provider": "file:/path/to/dsh-plugin-model-provider" }, "dsh": { "profile": { "bundles": ["dsh-plugin-model-provider"] } } } - Append to the profile's
cordis.patch.yml:- insert: - id: ui-model-provider-label name: 'dsh-plugin-model-provider' - Copy the plugin into
~/.dsh/profiles/desktop/node_modules/dsh-plugin-model-provider/. - Restart DeepSeek Harness.
Option 2: dsh plugin add (if available)
dsh plugin add /path/to/dsh-plugin-model-provider
Note: Some DSH versions have a file-lock issue with
dsh plugin add(EPERM onpackage.json.lock). Use Option 1 in that case.
How it works
Since 0.0.2 the plugin uses plain DOM decoration and registers no slots. Reason: plugins such as dsh-codex-subscription take over the single conversation.input.model slot without declaring the conversation.input.model.label child, so any slots.inject registration never runs; that child slot is also single, so connectors compete for it.
- Wraps
Response.prototype.json/textto learn the model → platform map from the host's own/api/session/modelCatalogresponse (the connection layer caches thefetchreference, so patchingfetchdoes not intercept it). - Opening the model menu additionally learns from group headings and option text as a fallback.
- Appends the platform name to the input-trigger label and the popup "Model" row via CSS
::afterplus adata-mp-platformattribute, without touching React children — so re-renders cannot wipe it. Dropdown candidates stay unchanged. - Trailing parenthesized qualifiers are stripped to avoid double parentheses; matching tolerates suffixes such as
Hy4 · x0.29.
Trade-off: it relies on the .codexModelSelect* DOM class names and needs updating if the host markup changes substantially.
Compatibility
- DeepSeek Harness >= 0.2.1-rc.3
- React ^18.2.0
- Web only (
dsh.client.platform: "web")
Files
| File | Description |
|---|---|
package.json |
Plugin manifest |
cordis.patch.yml |
Bundle patch declaration |
lib/index.js |
Server entry (no-op apply) |
lib/client.js |
Browser-side component (rendering logic) |
Rollback
Remove node_modules/dsh-plugin-model-provider/, remove the entry from dependencies and dsh.profile.bundles in the profile package.json, delete the insert block at the end of cordis.patch.yml, and restart.
Encoding note
All files use UTF-8 without BOM. DSH's resolveMeta() reads package.json via JSON.parse(readFileSync(path, "utf8")) without stripping BOM — a BOM would cause SyntaxError: Unexpected token '\uFEFF'. This matches all official plugins.
License
MIT
No comments yet. Be the first to write one.