为 DSH Web 输入栏提供按 provider 折叠的模型选择器,并使用模型目录中的真实推理档位。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-model-accordion
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:lakabuji-arch/dsh-model-accordion
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Provider-folded model selector for the DeepSeek Harness (dsh) Web composer.
This repository is the source of truth. The published npm package embeds a snapshot of this README and of the source comments taken at publish time (
0.4.0). Documentation fixes land here first and only reach npm with the next release, so when the two disagree — including the description shown on the npm page — this repository and itsmainbranch are authoritative.以本仓库为准。 npm 包里的 README 与源码注释是发布瞬间的快照(
0.4.0),之后修正的文档 只会先落在本仓库;两者不一致时(包括 npm 页面上显示的描述),以这里为准。
What it does
- Replaces the composer model seat (
conversation.input.model) with a provider-folded selector: provider groups stay collapsed until opened, and the provider holding the current model opens on a fresh menu. - Keeps the
0.2.xseat contract: same seat name, sameinjectface (available/directory/load/select), same rawRemoteResulthandling. - Reasoning effort. Picking a model submits its catalog-declared default effort; the trigger and every model row show the active level; a cell in the menu drills into the levels the model actually declares. There is no client-owned effort table, so an undeclared level is never offered.
- Label child seat. The seat declares
conversation.input.model.labeland renders it throughrenderSlot(), so the official1017badge — and any other plugin that decorates model names — keeps working instead of being bypassed. - The popup is portaled to
document.bodyand positioned with fixed coordinates clamped to the viewport, so composer overflow cannot clip it; it follows page scroll and resize. - Directory
failuresare listed per provider with a retry action, and the catalog error is shown as模型操作失败:…; asession/writer-heldrejection gets the dedicated "session already in use" message instead of a raw error. - Search is available at every catalog size (the
0.2.xbehaviour) and ranks by ordered-subsequence match on the model name only — descriptions and ids are excluded so prose cannot drag unrelated models into the result list. - Uses DSH semantic theme tokens (light/dark) and a built-in
model-accordionlocale dictionary (zh+en) registered on the client locale service and named on the seat. - Honours a catalog model's
badge({ tone, text }) the way the official seat does — before the name on the trigger, after it in the menu — and localizes its text throughresolveTextwhen the seat injects one.
Requirements
- DeepSeek Harness Web
0.2.x(verified against0.2.2-rc.1; the seat shape is unchanged from0.2.1-rc.2). - A Web profile with the official model-selection package and model-directory service.
- React 18 supplied by the DSH Web runtime.
This is a Web UI plugin with a small host half: it adds no Host service, model provider, vision
backend, or model catalog, and its host side only registers one agent/request-error listener for
the effort fallback described above. Provider availability and image-session admission remain
controlled by DSH and any installed provider/vision plugins.
Install from a package or repository
dsh plugin --profile web add dsh-model-accordion
For a local checkout during development:
dsh plugin --profile web add file:/absolute/path/to/dsh-model-accordion
Refresh the Web UI after installation. The package declares a dsh.bundle patch and a Web client
entry, so it is installed and loaded as a persistent profile bundle rather than a temporary runtime
extension.
Configuring reasoning levels
The selector never invents levels: it renders exactly what the model's catalog entry declares, and that declaration lives in the DSH profile config, not in this plugin.
For llm-pi-ai (relay / custom) models the declaration is reasoningEfforts in the profile patch:
- id: llm-pi-ai
config:
providers:
company:
models:
- id: deepseek-flash
reasoningEfforts:
low: low
high: high
max: ultra # key = DSH level, value = wire value sent upstream
Rules:
- The key must be one of DSH's thinking levels:
off,minimal,low,medium,high,xhigh,max. Any other key fails the wholellm-pi-aischema validation, and every provider under that plugin disappears from the picker (aturbo:key does exactly that). - The value is the string sent upstream and may be anything the gateway accepts — including a
level DSH has no name for.
max: ultrashows Max in the picker and sendsultra. - Mapping works the other way too:
off: noneturns DSH's Off into the gateway'snone. - A level you omit is pinned to unsupported (pi-ai receives
null), so the picker will not offer it;reasoningEfforts: falsedeclares a non-reasoning model. - The default shown by the picker comes from the adapter's
defaultEffort. When the adapter declares none, the picker showsDefaultand the request carries no effort (the provider decides).
中文说明
选择器里的挡位不是插件写死的,而是读 DSH 配置里模型声明的 reasoningEfforts:
- 键必须是 DSH 认识的七个之一:
off / minimal / low / medium / high / xhigh / max。 写成别的(比如turbo)会让整个llm-pi-ai配置校验失败,该插件下所有 provider 会一起消失。 - 值是真正发给上游的字符串,随便写。上游有、DSH 没有的挡位就用「映射」:
max: ultra—— UI 上显示 Max,实际发ultra。 - 反过来也行:
off: none—— UI 上的 Off 发none。 - 没写的挡位会被标成「不支持」,选择器不会显示;
reasoningEfforts: false表示这个模型不支持推理。 - 默认挡位来自适配器的
defaultEffort;适配器没声明时显示Default,请求里不带挡位(由网关决定)。
Behavior and limitations
- The seat registers with
priority: -1so it sits in front of the official picker instead of rendering next to it. - The seat factory declares
remote/remote.sessionnext to the services it uses, and a directory-resolver failure is tagged (dsh-model-accordion: model directory unavailable …) before it is rethrown, so the slot host still falls back to the official picker while the console keeps a searchable reason instead of a bare "slot entry crashed". - A subagent-addressed session renders nothing (the official seat does the same); a locked composer disables the trigger.
- Selection rejections render as an in-menu strip rather than the shared composer toast, so the plugin stays dependency-free on DSH UI primitives.
- Effort is only offered where the catalog declares it: a relay model without
reasoningmetadata shows no effort control, and the request keeps the provider default (shown asDefault). - An effort the model no longer declares is never sent blindly: the seat shows — and once
re-selects — the model default (falling back to the first declared level), and a selection the
host rejects with
UNSUPPORTED_REASONING_EFFORTis retried once with that fallback. - If the upstream rejects the effort (the catalog declaration is a client-side promise, not a
gateway guarantee), the host half hooks
agent/request-error, drops the pinned effort to the provider default for the same provider/model, and replaces the raw gateway body with an error that says what happened and whichreasoningEffortsdeclaration to fix; the seat shows the same notice. The turn is not resent on its own: the loop retries with the selection frozen at step start, so a mid-turn switch cannot reach the wire — resend the message after the switch. - Search input is retained across menu opens; clearing it collapses the accordion back to the provider holding the current model.
Development checks
node --check lib/client.js
node --check lib/index.js
node --test tests/package.test.js tests/render.test.js
npm pack --dry-run --ignore-scripts
tests/render.test.js executes the shipped bundle against a small hook runtime, so the component
body, store handling, child-seat rendering and menu structure are covered without a browser.
License
MIT
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-task-board★ 10562
侧边栏多列任务看板:卡片交给真实 DSH 智能体会话执行,支持 cron 定时(Host 侧到点执行,关浏览器也生效)。
zhu1090093659/dsh-web#packages/dsh-web-all★ 10562
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
ccch1mneyyy/dsh-TUI★ 8043
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7387
右下角常驻的小鲸鱼挂件:余额、今日已用与每轮对话消耗(含峰谷价),余额预警与今日预算的泡泡内容都可编辑;泡泡点击序列模块化自定义,支持并列加权 A/B、随机台词与随机图片;内置 30+ 厂商模板(OpenAI / OpenRouter / Kimi / 硅基流动 / 方舟 / 智谱 / MiniMax 等),按模型查余额与订阅额度;另有任务结束音效、导入音频、自定义角色与资源管理。数据全在本机,无遥测。
omdsh-dev/DSH-better-sidebar★ 5269
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
omdsh-dev/dsh-genui★ 1040
助手回复内渲染交互式 UI 组件:布局、图表、表单、测验、mermaid、3D 场景与回传事件循环。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。