跳过主要内容
H

dsh-cot-zh

hfdxgone/dsh-cot-zh

把展开后的「思考」正文边写边机翻成中文,一键切回英文原文。按段落切分、只翻已写完的段落、结果写入缓存,走微软翻译公开接口,不需要 API Key。

安装

dsh plugin --profile web add github:hfdxgone/dsh-cot-zh

README

dsh-cot-zh

English | 中文

Replaces DSH's expanded Think body with a Simplified Chinese machine translation, with the original one click away.

  • Browser-side translation: the translation comes from Microsoft's Edge translate endpoint (edge.microsoft.com/translate/translatetext); no account, key, or proxy is involved.
  • Translates while the agent writes: a completed paragraph is replaced as soon as its translation arrives; the paragraph still streaming stays in English until it completes.
  • Paragraph cache: translated paragraphs go into memory and localStorage, so re-expanding a row or reloading the page costs no request.
  • Visible failure: a failed paragraph falls back to the original with a retry button instead of blanking the body.
  • Raw text untouched: only the expanded rendering changes; the session's stored reasoning text and the collapsed Think summary stay as written.

Use

Expand any Think row and a toolbar appears above the body:

ElementMeaning
查看原文 / 查看译文Switch between the original and the translation; the translation is shown by default
翻译中…Some paragraphs have no translation yet
翻译失败 + 重试The request failed; the body falls back to the original

Turning the bundle off (Plugins → Installed → dsh-cot-zh) restores the untouched reasoning body.

Privacy and cost

  • Reasoning text goes from the browser straight to edge.microsoft.com (Microsoft). No key is needed, but the text does leave this machine; turn the bundle off when that is unacceptable.
  • One POST per paragraph, three at a time; a paragraph longer than 3000 characters is split at a line break or space.
  • Translations are cached in the browser's localStorage under the dsh-cot-zh:v1: prefix, with at most 400 in-memory entries.
  • Only the expanded body is replaced: the collapsed Think summary keeps its original text.

Implementation

A single-package bundle with no build step and no runtime dependencies:

  • cordis.patch.yml inserts one cot-zh row; apply in index.js is empty, because the Host takes no part in translation.
  • client.js is a hand-written browser module (window.__ModuleLoader__.load({ id, factory })) registering into the slot conversation.chat.reasoning.body with priority: 90, so it shadows the shipped body at priority 100. It renders Markdown through the root-scope factory conversation.chat.reasoning.content, so code blocks and footnotes keep their formatting.
  • Paragraph splitting preserves the original blank-line separators; oversized paragraphs are cut at a line break, then a space, into pieces of at most 3000 characters.

Known limitations

  • Simplified Chinese only (to=zh-Hans); the toolbar copy is Chinese.
  • No glossary protection: machine translation may rewrite inline identifiers.
  • Microsoft's endpoint has no SLA; a blocked network or a rate limit ends in the failure state and needs a retry.
  • DSH's experimental bundle @deepseek-ai/dsh-experimental-cot-translation-bundle occupies the same slot; enabling both makes them compete for one body position, so keep only one.

License

MIT, see LICENSE. Use it, change it, ship it commercially - just keep the copyright notice. No warranty.

相关插件