DeepSeek Harness Plugin: English-to-Chinese CoT

In the usage scenarios of DeepSeek Harness (DSH), reasoning models (such as DeepSeek, GLM, and Gemini) often output large amounts of English chain-of-thought content. For Chinese users, reading long English thinking processes can be mentally taxing. dsh-cot-en2cn aims to provide a non-invasive solution: when a thinking block is expanded, the translation is rendered directly below the original text, without modifying any session data.

Plugin Overview

This plugin is maintained by Eyeing0721 and is licensed under the MIT License. It is a Web UI plugin that coordinates between the browser side and the host side, using MutationObserver to monitor the conversation view and dynamically insert translated DOM. Core features include zero runtime dependencies, no access to API keys, caching on both sides, and 83 automated tests.

Installation and Enablement

System Requirements

  • DeepSeek Harness (DSH) >=0.1.0-rc.5
  • Node.js >=20

Installation Commands

Install from GitHub (recommended):

dsh plugin --profile web add github:Eyeing0721/dsh-cot-en2cn

If the download step gets stuck in mainland China, it is recommended to set a proxy first before running the command:

$env:HTTPS_PROXY = 'http://127.0.0.1:7897'

Install from a Local Directory

When installing from a local directory (link mode), the source directory must not be deleted or moved, otherwise the plugin will become invalid.

dsh plugin --profile web add /path/to/dsh-cot-en2cn

After installation is complete, restart dsh web, then refresh the browser page to enable it.

Uninstall

dsh plugin --profile web remove dsh-cot-en2cn

Usage

  1. UI Interaction: Expand any “Thinking” block, and the Chinese translation is rendered directly below the original thinking text. A vertical line is displayed on the left side of the translation, and the top shows the model used, cache hit status, and elapsed time. The top-right corner provides Retranslate, Copy, and Collapse buttons.
  2. Trigger Mechanism:
    • Collapsed thinking blocks are never translated and do not trigger model calls.
    • If the original text is in Chinese, it is skipped directly without sending a request.
    • When a thinking block is expanded, if the model is still streaming output, the plugin waits by default until the thinking is complete before translating.
  3. Control Panel: Go to Settings → Plugins → “CoT English to Chinese” to open the configuration panel.

Configuration Options

Configuration file path: $DSH_HOME/storages/cot-en2cn/config.json. All configuration options are validated when loaded.

Config Item Default Description
Enable CoT Chinese Translation On Master switch; turning this off makes all translation panels disappear immediately.
Auto-translate on Expand On If disabled, each thinking block requires manually clicking “Translate this thinking”.
Translate During Thinking Off Translate while the model is still streaming output (uses more tokens).
Provider / Model Empty Leave empty to follow the DSH default model. It is recommended to select a cheap, fast small model for translation.
Disable Thinking (Recommended) On This mapping is recognized only by the official DeepSeek adapter.
Target Language Simplified Chinese Optional: Traditional Chinese / English / Japanese.
Characters per Block 3000 If exceeded, translate in chunks and cache them. A smaller value is more stable but increases the number of requests.
Concurrent Requests 2 Number of simultaneous model requests.
Per-request Timeout 120 seconds Deadline for a single model request.
Server-side Cache Entries 600 Translations are cached by “block”.
Skip Thinking Already in Chinese On If the original text is already in Chinese, skip it directly.
Translation Font Size 13px Only affects the display of the translation panel.

Principles and Security

The plugin uses a two-sided architecture:
- Host side (lib/index.js): Registers six local same-origin routes (such as /dsh-cot-en2cn/translate), initiates translation requests through DSH’s ctx.llm.stream(), and strictly restricts access to localhost-only requests.
- Browser side (lib/client.js): Uses MutationObserver to monitor the conversation view, finds thinking nodes with the data-variant="think" attribute, and dynamically inserts the translation DOM below them.

This provides three guarantees:
1. Never pollutes session data: It does not write session logs, and the Trajectory view is unaffected.
2. Zero side effects: The plugin can be disabled at any time, and the UI returns to its native state.
3. Graceful degradation: If DSH changes its DOM structure, the plugin simply does not display translations and does not break host page rendering.

Quality Assurance

The project includes 83 automated tests and has no third-party framework dependencies.

npm test

Test coverage includes long-text chunking reversibility, Chinese detection, cache read/write, concurrency control, configuration validation, and DOM event interception.

  • GitHub: https://github.com/Eyeing0721/dsh-cot-en2cn
  • DSH Catalog: https://www.skillhub.cn/plugins/Eyeing0721/dsh-cot-en2cn
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye