huashu-design
alchaincyf
Huashu Design 3.0 · 在 agent 里打一句话,拿回能交付的设计:网页 / App 原型 / 可编辑 PPTX / 动画 / 信息图 · 六个候选挑三个方向 · 84 种带样张的风格库 · 越用越懂你的外观账本与设计体检 · HTML-native design skill for Claude Code, Codex, Cursor & any agent
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:ChenYichener/dsh-translate
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English · 简体中文
A DeepSeek Harness sidebar plugin that turns the app into a Chinese↔English translation workbench: streaming translation, an always-on AI tutor, automatic example sentences, predicted follow-up questions, source-text corrections, saved history and neural read-aloud.

Enter in the source box starts a translation (pressing it again while streaming stops it); Shift+Enter inserts a newline. The box is focused when the panel opens, so paste + Enter is the whole flow.已复用历史 (reused from history). 重译 / Retranslate forces a fresh model rendition.After a translation finishes, the host makes one extra model call that returns every learning aid below at once. The results are stored on the record, so replaying it from history costs zero calls.
| Block | What you get |
|---|---|
| 常用例句 · Examples | 2–3 example sentences built on useful expressions from the translation: English sentence + Chinese meaning, on separate lines. |
| 猜你想问 · Predicted questions | 2–3 likely follow-up questions; one click sends the question to the tutor. |
| 原文纠错 · Source corrections | Only the side you typed is checked, in its own language: zh→en checks Chinese typos, grammar and collocations; en→zh checks English grammar (tense, agreement, plural, articles, prepositions, possession, word order), spelling, capitalization and collocations. Each row shows wrong → suggestion, a category badge (spelling / capitalization / grammar / collocation / wording), a one-line reason and a correct example. |
| 音标 · IPA | 2–4 useful English words/phrases with IPA and a Chinese meaning; a misspelt source word is annotated in its corrected form (e.g. check-in /ˈtʃek ɪn/). |
| 译文优化 · Polished alternatives | 1–2 more natural, polite or accurate renderings with a one-line reason — only when the current translation can genuinely be improved. |
Corrections are grounded: any fragment the model quotes must actually occur in your source text, otherwise it is dropped, so the model cannot invent a correction from its own translation. Grammar, spelling, capitalization and collocation are requested as separate sections, so a spelling fix never hides a grammar problem. Every correction can be turned into a one-click "why does X become Y?" question for the tutor.
edge-tts environment. 15 online voices are built in across US / UK / AU / CA / IE / IN accents.say, including Premium/Enhanced voices) → browser speechSynthesis. On Windows/Linux without Python the plugin stays on the browser voice instead of failing.dsh plugin --profile <profile> add github:ChenYichener/dsh-translate
git clone https://github.com/ChenYichener/dsh-translate.git
dsh plugin --profile <profile> add /path/to/dsh-translate
Plugins page → Install from local directory → pick the dsh-translate folder → enable it.
After installing, restart dsh web or refresh the page. The sidebar entry appears directly below the Pomodoro item (sidebar order 22; without dsh-pomodoro it simply follows the previous entry).
| Dependency | Notes |
|---|---|
| DSH | Desktop app or a self-hosted Web profile. Validated against 0.2.1-rc.5; the external plugin API is still early. |
| Node.js | >= 20 (from engines). |
| Model | Reuses the current profile's default model — no extra API key for the plugin. |
| Read-aloud, online (optional) | Python 3.9+ and network on first use. The plugin creates a private venv in ~/.dsh/dsh-translate/tts-venv and installs edge-tts 7.3.1 there (20–60 s, ~20 MB); it never touches the system Python. |
| Read-aloud, local (optional) | macOS say works out of the box. |
| Read-aloud, fallback | Browser speechSynthesis — zero dependencies. |
Enter (or click 翻译). The translation streams in; when it finishes, examples, predicted questions, IPA, corrections and polished alternatives appear next to it.| Where | Shortcut | Action |
|---|---|---|
| Source box | Enter |
Translate; while streaming, stop |
| Source box | Shift + Enter |
Newline |
| Source box | ⌘ / Ctrl + Enter |
Translate (same as Enter) |
| Tutor box | Enter |
Send question |
| Tutor box | Shift + Enter |
Newline |
| Tutor box | ⌘ / Ctrl + Enter |
Send (same as Enter) |
Pressing Enter in the tutor box while an answer is streaming stops that answer, matching the source box.
| Always-on tutor |
|---|
![]() |
index.js is the host half: it mounts a prefix route at /dsh-translate/api on the host webServer, and reads the profile's current model from ctx.get('llm') plus ctx.get('agentDefaultModel'). client.js is the browser half, loaded through the host module loader; it registers the sidebar.panellist row (id translate, order 22) and the main.translate panel through slots.POST /translate is an SSE endpoint: the host resolves auto direction from CJK/Latin ratio, checks the history fast path, then streams llm.stream() with reasoningEffort: 'off' and sends start / delta / done / error events. The finished record is saved host-side and returned in done.done, the client calls POST /insight once. The host asks the model for fixed sections (【例句】 【猜你想问】 【音标】 【译文优化】 【语法】 【拼写】 【大小写】 【搭配与用词】), parses rows, merges duplicates, drops placeholders and any correction whose quoted fragment is not actually present in the source, then writes the result back onto the matching history record.POST /ask is a separate SSE route. The host folds the current translation context and up to 12 prior turns into one prompt; answers are not saved. Aborting the request aborts the model stream.POST /tts returns binary audio: edge-tts (run as a separate process in the plugin venv) produces audio/mpeg, macOS say produces audio/wav, and the x-tts-engine response header reports what actually ran. The client plays the bytes and falls back to speechSynthesis when the host answers 503.Host headers, Sec-Fetch-Site: cross-site and cross-origin Origin (DNS-rebinding / CSRF posture), and bounds request bodies and text fields.localStorage.| What | Where it goes |
|---|---|
| Translation prompt, study notes and insight request | Sent to the model provider configured in DSH. |
| Tutor questions and context | Sent to the model provider configured in DSH. |
| Text you read aloud with an online voice | Sent to the Microsoft Edge TTS endpoint. |
| Text read with the local voice | Stays on the machine (macOS say). |
| History | ~/.dsh/dsh-translate/history.json (last 500 records). |
| History backups | ~/.dsh/dsh-translate/history.YYYY-MM-DD.bak.json (up to 7). |
| Read-aloud environment | ~/.dsh/dsh-translate/tts-venv/ — a plugin-private Python venv. |
| Audio cache | ~/.dsh/dsh-translate/tts-cache/ — MP3/WAV keyed by engine + text + voice + speed. |
| UI preferences | Browser localStorage, key dsh-translate/prefs/v1. |
The plugin has no telemetry, no analytics, no accounts and no API keys of its own. Tutor conversations are memory-only. Delete tts-venv and tts-cache to reset read-aloud (the next use prepares the venv again). Because the Edge voice is used by default, read-aloud text leaves the machine unless you stay on the local/browser voice (for example while offline).
A saved record looks like this (abridged):
{
"id": "04ef945ef4fd4968",
"createdAt": "2026-11-03T04:36:12.000Z",
"direction": "zh-en",
"study": false,
"source": "请给我一杯水。",
"translation": "Please give me a glass of water.",
"notes": "",
"examples": ["Could you give me a glass of water, please? — 请给我一杯水好吗?"],
"questions": ["a glass of water 和 a cup of water 有什么区别"],
"corrections": [],
"phonetics": [{ "word": "glass", "ipa": "/ɡlæs/", "meaning": "玻璃杯" }],
"polish": [{ "suggestion": "Could I have a glass of water, please?", "reason": "more polite" }]
}
There is no config file and no environment variable. Everything is changed in the panel:
Preferences persist per browser profile under the dsh-translate/prefs/v1 localStorage key. The default model is whatever the DSH profile has selected — the plugin does not have its own model setting.
There is no build step: both halves are plain JavaScript and ship as-is.
# syntax check
node --check index.js
node --check client.js
# try a local build in a throwaway profile
dsh plugin --profile test add /path/to/dsh-translate
index.js is an ESM module exporting inject and apply; client.js is a browser bundle wrapped in window.__ModuleLoader__.load({ id, factory }). Plugin behavior lives entirely in those two files.
dsh-translate/
├── index.js # host half: /dsh-translate/api routes
├── client.js # client half: sidebar entry + main.translate panel
├── cordis.patch.yml # bundle patch that inserts the plugin
├── package.json # package metadata + dsh bundle/client manifest
├── locale/
│ ├── en.json # plugin-page title and description
│ └── zh.json
├── icon.svg
├── docs/
│ ├── screenshot.png
│ └── screenshot-tutor.png
├── README.md
├── README.zh.md
└── LICENSE
The host half exposes one prefix route, /dsh-translate/api. Every endpoint is POST with a JSON body; streaming endpoints use SSE. Responses are JSON { ok, ... } or binary audio.
| Route | Request | Response |
|---|---|---|
/translate |
{ text, direction?, study?, force? } |
SSE: start → delta* → done with the saved record; a cached hit sends start/done with cached: true and no deltas. force: true skips the fast path. |
/insight |
{ source, translation, direction, notes?, id? } |
JSON { examples, questions, corrections, phonetics, polish, record? }. One model call; returns the existing data immediately when the record is already enriched. |
/ask |
{ question, context?, messages? } |
SSE: start → delta* → done. |
/tts |
{ text, voice?, rate? } |
Binary audio/mpeg (Edge) or audio/wav (say), x-tts-engine header; 503 when only the browser voice is available. |
/info |
{} |
Model name, whether AI is available, history file path and count, cumulative modelCalls per kind (translate / insight / ask), and TTS defaults, voices and edge.status (idle / installing / ready / failed). |
/history/list |
{} |
{ records }, newest first. |
/history/delete |
{ id } |
{ deleted }. |
/history/clear |
{} |
Deletes all records. |
The design is deliberately cheap: a translation is one model call plus one optional insight call, and repeat translations are free.
| Action | Model calls |
|---|---|
| New translation, including examples / predicted questions / IPA / corrections / polish | 2 — one translation (study notes ride along) + one insight call |
| Repeating an identical translation (history hit) | 0 |
| Tutor question | 1 per question |
| Stopping, switching panels, aborting | 0, and nothing is saved |
/info returns a modelCalls counter (translate / insight / ask) so you can verify the actual usage yourself.
| Symptom | Fix |
|---|---|
| No 翻译 entry in the sidebar | Check the Plugins page that it is enabled; refresh the page or restart the app; inspect the app log for a dsh-translate load error. |
| Plugin missing from the installed-plugins list after a manual link install | The plugin manager cached its inventory for this app session — click Refresh on the Plugins page or restart. |
| Read-aloud always uses the local/browser voice | Check tts.edge.status in /info: installing means the first-time setup is running (20–60 s); failed shows the reason in tts.edge.error (usually no Python 3, a failed first pip install, or a blocked network). Fix Python/network and restart. |
| Online voice suddenly stops working | Upstream Edge TTS or the network changed; the plugin automatically falls back to the local/browser voice. To stay local-only, delete ~/.dsh/dsh-translate/tts-venv and go offline. |
| Only a few macOS voices | System Settings → Accessibility → Spoken Content → System Voice → Manage Voices, install Premium/Enhanced voices; they appear within a minute. |
| Reset read-aloud | Delete ~/.dsh/dsh-translate/tts-venv and tts-cache, then restart the app. |
| Translation not saved | Only translations that finish are saved; stopping mid-stream saves nothing. |
| Repeated input returns an old translation | That is the history fast path — click 重译 to force a fresh rendition. |
| No model available | Select a default model in DSH model settings; the plugin reuses the profile default. |
| Platform | Plugin | Read-aloud |
|---|---|---|
| macOS | ✅ | Edge neural voice (recommended) / local say (incl. Premium/Enhanced voices) / browser voice |
| Windows | ✅ | Edge neural voice (needs Python 3.9+ and network, auto-prepared) / browser voice |
| Linux | ✅ | Edge neural voice (needs python3 and python3-venv) / browser voice |
| Offline | ✅ translation needs the model service | macOS: local say; others: browser voice |
Validated on macOS with DSH 0.2.1-rc.5. Windows and Linux path/Python detection is implemented per platform but has not been regressed on real hardware — issues and PRs welcome. DSH's external plugin API (webServer, sidebar.panellist / main slots, dsh.bundle.patch) is still early; after a major DSH upgrade, re-check the dsh field in package.json if the plugin stops loading. The browser fallback depends on the Web Speech API's English voices, whose quality varies by system.
| Plugin | What it does |
|---|---|
| dsh-book | Markdown draft library + AI copywriting workspace for Xiaohongshu / WeChat / generic posts |
| dsh-notify | Native desktop notification when a session finishes while DSH is in the background |
| dsh-pomodoro | Distraction-free Pomodoro timer in the sidebar |
| dsh-translate | Chinese/English translation workbench with an always-on AI tutor and neural read-aloud |
| dsh-nce | New Concept English Book 1 study panel (lessons, SRS flashcards, mistake notebook) |
icon.svg is original to this repository; the UI uses only DSH theme tokens and system fonts.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: translation。