Skip to content
dsh.fish
Bundle

dsh-chinese-mode

DSH 全局中文模式:输入框「中」字开关,开启即向任意 preset 注入语言要求;区域开关控制中文/英文,锚定模式可单独设定思考语言。

Source
dawnliming
stars
4 stars
License
MIT
Updated
Updated 6 days ago

Readme

# dsh-chinese-mode

DeepSeek Harness Web 全局中文模式插件:在输入框权限选择后提供一个「中」字开关,开启后向**任意 preset** 的 system prompt 注入中文要求。

> 简体中文是默认文档语言。英文版见 [README.en.md](README.en.md)。

## 功能

- **全局且持久化**:开关存于宿主侧设置(`dsh-chinese-mode` 命名空间),对所有会话生效。
- **无条件注入**:开启即注入,不做「已有中文」检测;注入位置在 persona 之前。
- **分区域语言开关**:回复、思考、工具三块区域各自开关——开启=中文,关闭=英文(正向指令,实测有效)。
- **设置页**:在 dsh 设置中提供「中文模式」配置页(总开关、区域开关、锚定关键词与行为)。文案由内置默认值管理,避免手动填写污染 system prompt。
- **输入框快捷开关**:输入框旁的「中」开关一键关闭;总开关关闭时按钮自动隐藏,设置页是唯一入口。
- **任意 preset 均生效**,包括 complete persona。
- **锚定模式**:开启后锚定 preset 下思考用英文、回复/工具仍按设定;关闭则无视锚定,按常规设定。
- **关闭即移除**:关闭总开关后从后续组装中移除该 section;不翻译历史消息,也不插入可见聊天内容。

## 安装

插件市场上架后可一键安装,或命令行:

```bash
dsh plugin --profile web add github:dawnliming/dsh-chinese-mode
```

安装后重启 `dsh web`,在输入框权限选择后拨动「中」开关即可。

## 设置字段

| 字段 | 默认 | 说明 |
| --- | --- | --- |
| `enabled` | `false` | 总开关;关闭后完全不注入,输入框按钮隐藏。 |
| `replyChinese` | `true` | 回复区域语言:开=中文,关=英文。 |
| `thinkingChinese` | `true` | 思考区域语言:开=中文,关=英文。 |
| `toolsChinese` | `true` | 工具/界面区域语言:开=中文,关=英文。 |
| `textReply` / `textThinking` / `textTools` | 各区域默认中文文案 | 内置中文文案(英文文案内置对应英文版);设置页不提供编辑,避免污染。 |
| `anchoredPresetKeywords` | `liangshen, 梁神, anchored, 锚定` | 视为锚定模式的 preset 名称关键词(逗号分隔,设置页可编辑)。 |
| `anchoredMode` | `true` | 锚定 preset 下思考用英文,回复/工具按设定;关闭则无视锚定。 |

> 旧版单个 `text` 字段会在升级后自动作为「回复文案」保留。

## 原理

宿主侧包装 `systemPrompt.assemble` 并监听官方 `system-prompt/assemble` waterfall 事件,在组装完成后把 `dsh-chinese-mode:language` section 插到 persona 之前(或追加到末尾),从而保证发给模型的 `system` 消息始终携带中文要求。客户端渲染绑定到 `dsh-chinese-mode` 设置命名空间的「中」开关。

## 开发

- 宿主:`lib/index.js`
- 客户端:`lib/client.js`(ModuleLoader bundle,修改后需重新构建)
- 本地安装到 profile(`file:` 依赖):

```bash
cd ~/.dsh/profiles/web
pnpm add file:../../plugins/dsh-chinese-mode
# 并在 package.json 的 dsh.profile.bundles 加入 "dsh-chinese-mode"(或让 dsh 自动 reconcile)
```

## License

MIT

Install

dsh plugin --profile web add github:dawnliming/dsh-chinese-mode#a48999b51e05d0cf018e0acfd3107d6a141a1218

Profile: web

Source