H
dsh-cot-zh
hfdxgone/dsh-cot-zh
把展开后的「思考」正文边写边机翻成中文,一键切回英文原文。按段落切分、只翻已写完的段落、结果写入缓存,走微软翻译公开接口,不需要 API Key。
安装
dsh plugin --profile web add github:hfdxgone/dsh-cot-zhREADME
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:
| Element | Meaning |
|---|---|
查看原文 / 查看译文 | 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
POSTper 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
localStorageunder thedsh-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.ymlinserts onecot-zhrow;applyinindex.jsis empty, because the Host takes no part in translation.client.jsis a hand-written browser module (window.__ModuleLoader__.load({ id, factory })) registering into the slotconversation.chat.reasoning.bodywithpriority: 90, so it shadows the shipped body at priority 100. It renders Markdown through the root-scope factoryconversation.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-bundleoccupies 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.