Bundle
dsh-chat-tweaks
DSH web UI-tweak plugin: show the provider display name next to the model name in the composer model seat, remove the chat column max-width, and more — every feature has its own switch on a dedicated Settings page. / DSH web 界面美化插件:在模型选择器显示厂商名、取消对话列最大宽度等,每个功能都在独立的「设置 → 聊天增强」页中开关。
- Source
- haiyoucuv
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 14 days ago
Readme
# dsh-chat-tweaks
> DeepSeek Harness 的界面美化插件:在模型选择器显示 **厂商名**、取消对话内容**最大宽度**等,每个功能都在独立的**设置 → 聊天增强** 页面中独立开关,全部即时生效、无需重启。
>
> A UI-tweak plugin for the DeepSeek Harness: show the **provider display name** in the composer model seat, remove the chat column **max-width**, and more — every feature has its own switch on a dedicated **Settings → Chat Tweaks** page, applied live without a restart.
[](LICENSE)
[](https://github.com/haiyoucuv/dsh-chat-tweaks/releases)
[中文](README.md) | [English](README_EN.md)
## 功能
| 开关 | 效果 |
| --- | --- |
| **显示厂商名** | 模型选择器(输入框旁的模型座位)同时显示 provider 显示名与模型名,区分不同厂商下的同名模型(如 `DeepSeek · DeepSeek-V4-Flash`) |
| **取消内容最大宽度** | 消息列不再受 `748px`(`--dsh-chat-content-width`)限制,占满可用空间 |
所有功能以注册表(`src/client/features.ts`)组织,**新增一个 UI 功能 = 加一条注册项 + 两句文案**,设置页自动多出一个开关(见[扩展指南](#新增一个-ui-功能扩展指南))。
## 截图
设置 → 聊天增强(独立设置页):

模型座位显示厂商名:

## 安装
```bash
# 从 GitHub 安装(推荐,发布后)
dsh plugin --profile web add https://github.com/haiyoucuv/dsh-chat-tweaks/archive/refs/tags/v0.1.0.tar.gz
# 或从本地目录(开发调试)
dsh plugin --profile web add link:/path/to/dsh-chat-tweaks
```
> 也可以直接在 profile 目录用 pnpm 安装:
>
> ```bash
> cd ~/.dsh/profiles/web && pnpm add /path/to/dsh-chat-tweaks
> ```
> ⚠️ **旧版 `dsh-model-provider-label` 已停止维护**:其「显示厂商名」功能已并入本插件。如果你安装过旧版,请先卸载——二者都占用 `conversation.input.model` 单槽位、优先级同为 `-100`,共存会抛错:
>
> ```bash
> dsh plugin --profile web remove dsh-model-provider-label
> ```
>
> 旧版插件说明与历史版本见指南:<https://github.com/haiyoucuv/dsh-model-provider-label>
安装后**重启 `dsh web`**(Ctrl+C 后重新运行 `dsh web`),使浏览器端加载新插件 bundle。
## 暴露设置命名空间(必需,一次性)
> ⚠️ 这是本版本 DSH 的已知限制:浏览器可读写的设置命名空间被硬编码在 `dsh-host-apiproxy` 的 `WEB_SETTINGS_NAMESPACES` 白名单里。**不执行本步骤时,设置页的开关会显示为禁用、写入失败**(错误码 `settings-not-exposed`)。
执行插件自带的幂等补丁脚本(profile 重装或 dsh 升级后可重跑):
```bash
npm run expose # 等价于 node scripts/patch-apiproxy.mjs
```
然后**再次重启 `dsh web`**。之后开关即可正常读写,值持久化在 `~/.dsh/settings.yaml`。
## 使用
打开 **设置 → 聊天增强**,按需切换:
- **显示厂商名**:开 / 关模型座位上的厂商名前缀;
- **取消内容最大宽度**:开 / 关消息列全宽。
所有改动即时生效,无需重启。
## 开发
```bash
pnpm install # 安装 esbuild / typescript 等开发依赖
npm run build # 产出 lib/index.js(节点端)与 lib/client.js(浏览器端)
npm run typecheck # TypeScript 类型检查
```
`lib/` 由 `scripts/build.mjs` 生成并提交,修改 `src/` 后重新构建即可(页面刷新即生效,无需重启服务)。
## 工作原理
- **节点端**(`src/index.ts`):注册 `dsh-chat-tweaks` 设置命名空间(默认全开),值持久化到 `~/.dsh/settings.yaml`。
- **浏览器端**(`src/client/`):
- 通过 `ctx.settingsScope.bind` 订阅设置;带 `apply` 的功能开关实时执行对应副作用;
- 在 `settings.section` 槽位注册**独立设置页**「聊天增强」(导航标签 + 页面,与「模型 / 插件 / Agent 预设 / 文件提及」并列),开关数量由 `FEATURES` 注册表驱动;
- 以优先级 `-100` 遮蔽 `conversation.input.model` 座位,厂商名开关联动 trigger 显示(数据复用宿主 `modelDirectories` 服务,行为与原生实现一致)。
全宽 CSS 用稳定的 `[data-chat-flow]` 属性选择消息列(不依赖哈希类名),`!important` 覆盖内置规则,开关即时注入/移除 `<style>` 标签。
## 新增一个 UI 功能(扩展指南)
1. `src/client/features.ts` 的 `FEATURES` 数组加一条:`{ key, labelKey, descKey, default, apply? }`
- `apply(enabled)`:开关变化时执行的副作用(注入/移除 CSS 或 DOM 变化);
- 渲染类功能(如厂商名)无需 `apply`,组件内通过 settings scope 响应式读取。
2. `src/client/index.tsx` 的 `zh` / `en` 字典加对应文案(`label` / `desc` 两个 key)。
3. `src/index.ts` 的 schema 加同名字段(默认值与注册表一致)。
4. `npm run build`,刷新页面——设置页自动多出一个开关。
## 常见问题
| 现象 | 原因与解决 |
| --- | --- |
| 设置页开关是**禁用**状态 | 命名空间未暴露:运行 `npm run expose` 并重启 `dsh web` |
| 修改代码后界面没变化 | `lib/` 未重建:运行 `npm run build` 后刷新页面 |
| 模型座位消失/报错 | 与旧版 `dsh-model-provider-label` 共存:卸载旧插件 |
| 设置值存到哪里 | `~/.dsh/settings.yaml` 的 `dsh-chat-tweaks` 一节 |
## 兼容性
- 目标平台:DeepSeek Harness **web**(`dsh --profile web`),版本 `0.1.0-rc.6` 系列;
- 依赖:见 `package.json` peerDependencies。
## License
[MIT](LICENSE) © dsh-chat-tweaks contributors
Install
dsh plugin --profile web add github:haiyoucuv/dsh-chat-tweaks
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-chat-tweaks from the hub
- 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.