dsh-translator: Paragraph-by-Paragraph Translation of AI Responses in DSH Web

Introduction

When conversing with models in DeepSeek Harness (DSH), a common practice is to copy entire paragraphs into external translation tools, or open a separate window to read side by side. DSH itself does not provide an interface capability for “one-click translate paragraph by paragraph, next to the original text.” The dsh-translator maintained by mikulo is a Web plugin classified as a “client”: it provides translation controls below each paragraph of an AI response (excluding chain-of-thought), calling the models you have configured in Settings → Models to translate the selected paragraph into the target language. The translation is displayed below the original or replaces the original display on the page (without altering the context sent to the model).

What Is This

dsh-translator (npm package name @mikulo/dsh-translator, current version 1.0.1) is a standard DSH bundle: package.json declares dsh.bundle.patch and dsh.client; both Host and Browser sides are pure ESM with no runtime dependencies and require no build step during installation.

Translation requests are sent through DSH’s own model service, using the API Key from Settings → Models; the plugin does not store keys separately.

Core Features

The following summarizes the behavior described in the README, to facilitate reference when using the interface.

Paragraph-by-Paragraph Translation and Replacement Display

After each paragraph of an AI response (each text block in each response step) finishes generating, “Translate” and “Replace Original” appear at the bottom right below the paragraph. Chain-of-thought, tool calls, and user messages do not show buttons; buttons are not displayed while the response is still streaming.

  • Translate: The translation is placed after the original text and before the next paragraph, in the normal document flow, not floating over or covering the original.
  • Replace Original: The translation occupies the original text’s position on the page (the original is hidden), and the button becomes “Show Original”; clicking it again restores the display. Only page display is changed: the conversation history and the context sent to the model remain the original text, and “Copy” at the bottom of the turn also copies the original text.

Translations are rendered as Markdown (code blocks, lists, tables, etc. keep the same style as the original), with a thin colored bar on the left to distinguish them, and the target language, model used, and thinking strength are noted. RTL languages such as Arabic and Urdu are laid out right-to-left (from version 1.0.1, the target language list focuses on ten common languages, see settings below).

Display, Re-translation, and Cancellation

After translation completes, “Translate” becomes “Hide Translation / Show Translation”; the two display modes can be switched without duplicate requests, and the adjacent ↻ can re-translate. Clicking the spinning button again while translation is in progress cancels it.

Auto Scrolling

After clicking a button, if the height changes due to expansion, collapse, or replacement of long text, the conversation area will try to scroll near the first line of the translation (when hiding the translation or showing the original, it positions to the first line of the original); if the first line is already within the viewport, no movement occurs. If the user scrolls on their own or clicks another paragraph while waiting for translation, the returned translation will no longer force a jump.

Errors and Models

In cases of model timeout, model not existing or having been deleted, no model configured, API errors (balance, key, etc.), inability to connect to dsh web, plugin Host not loaded, etc., the reason is displayed in red text on the left side of the button, and the failed button becomes “Retry”; if replacement fails, the original text remains displayed. When the Host is not loaded, the settings page and next to the button will show “Please restart dsh web.”

The model list on the settings page is consistent with Settings → Models (same source as the dialog model selector), grouped by provider; you can select “Follow DSH default model”. Thinking strength is off by default, with options low / medium / high; if the model does not support the selected level, it will automatically map to the closest level and prompt on the settings page.

Languages, Prompts, and Filtering

The default target language is Simplified Chinese, with ten options available: Simplified Chinese, English, Traditional Chinese, 日本語, 한국어, Français, Español, Deutsch, Русский, Português. Translation prompts can be customized; {{target}} is the target language and {{text}} is the original text (if {{text}} is not written, the original text will be appended at the end); saving with the field empty restores the built-in default.

The default setting “Only show translation button in paragraphs containing English” is enabled (a small number of English terms within a Chinese response does not count as “containing English”); after disabling it, buttons will be shown in all response paragraphs.

Cache and Testing

Translations are retained on the page and remain after switching conversations and returning; the most recent 200 entries are saved in the browser’s localStorage (key name dsh-translator.cache.v1) and can still be restored after a refresh. At the bottom of the settings page, you can input text to test the current configuration.

Installation and Activation

In the DSH ecosystem, plugins can be installed via community manifests or directly via dsh plugin; after installation, you must restart dsh web and refresh the page (the Browser half can hot-update with the page, but the Host half requires restarting the process to load new code).

git clone https://github.com/mikulo/dsh-plugins.git
cd dsh-plugins
node install.mjs --profile web --only dsh-translator

Direct Installation

dsh plugin --profile web add github:mikulo/dsh-translator

Maintenance commands (from the README):

dsh plugin --profile web update @mikulo/dsh-translator
dsh plugin --profile web remove @mikulo/dsh-translator

Restarting dsh web is also required after updates or installation.

Typical Usage

  1. Open Settings → Response Translation, select the translation model (or Follow DSH default model), thinking strength, and target language; after adding or removing models in Settings → Models, click “Refresh” on the response translation page to sync the list. Test at the bottom lets you verify the configuration first.
  2. In a conversation, wait for an AI text paragraph to finish generating, then click Translate or Replace Original below that paragraph, switching between hiding/showing the translation or showing the original as needed.
  3. When you need to change the timeout or prompt, adjust Timeout (seconds) (default 60, range 5–600) and Translation prompt on the same settings page.

Default prompt template (can be overridden in settings):

将下面的文本翻译为{{target}}。要求:
- 只输出译文,不要添加任何解释、注释或前后缀;
- 保留原有的 Markdown 结构(标题、列表、表格、引用、链接);
- 代码块、行内代码、命令、文件路径和 URL 保持原样,不要翻译;
- 专有名词和技术术语可保留原文。

{{text}}

Settings and Data Locations

Setting Default Description
Translation model Follow DSH default model From Settings → Models; click refresh after changes
Thinking strength Off Off / low / medium / high
Translate to Simplified Chinese Ten common languages
Translation prompt Built-in template {{target}}, {{text}}; saving empty restores default
Timeout (seconds) 60 5–600
Only show translation button in paragraphs containing English On Turning off shows buttons in all response paragraphs
  • Plugin settings file: ~/.dsh/dsh-translator.json (if DSH_HOME is set, then $DSH_HOME/dsh-translator.json), separate from the DSH main configuration; reinstalling or updating the plugin will not clear these items.
  • Translation cache: local browser localStorage only.

How It Works (Briefly)

The Host half (lib/index.js) provides /api/dsh-translator/* accessible only locally; the model list is resolved through DSH’s llm service, consistent with the built-in model selector; when translating, it calls llm.stream(), takes only the main text blocks, and discards thinking content. The Browser half (lib/client.js) registers the Response Translation settings page and inserts a container after each completed AI text block, rendering buttons and translations through a React portal; it prefers using the original Markdown from DSH’s MarkdownText, falling back to the page’s visible text when unavailable.

Use Cases and Notes

This is suitable for reading English (or other language) model outputs within DSH Web without leaving the conversation page to copy and paste. The plugin runs with the permissions of the current dsh web process; before installation, it is recommended to read the repository source code and LICENSE to confirm compliance with your environment and requirements. Community directories such as SkillHub are independent sites with no official affiliation with DeepSeek / High-Flyer, and are not official app stores.

Conclusion

dsh-translator embeds “paragraph-by-paragraph translation” into the DSH conversation UI: it reuses existing model configurations, distinguishes chain-of-thought from main text, and clarifies that “Replace Original” only affects display. For installation instructions and changelogs, refer to the GitHub README.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye