dsh-think-translate 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # dsh-think-translate
2
+
3
+ **思考链翻译** — 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web UI 提供显示层翻译:把界面上的**思考链(Think 行)、任务卡片、回答正文**翻译为你选择的目标语言,原文完整保留在会话记录中。
4
+
5
+ ## 特性
6
+
7
+ - **8 种目标语言**:中文 / English / 日本語 / 한국어 / Español / Français / Deutsch / Русский
8
+ - **单一语言 UI**:设置面板、思考行、任务卡片全部跟随目标语言(不混中英),语言选择持久化
9
+ - **本地模型为主力**:优先使用本地 Ollama 模型(qwen 等),隐私离线免费;**首次选择本地模型时自动触发下载**,带实时进度条,完成后自动配置启用
10
+ - **Google / Bing 兜底**:本地模型不可用时自动切换(google 通过 Node CONNECT 隧道走系统代理,绕过反爬)
11
+ - **代码工件自动跳过**:文件路径、命令、URL、正则、纯代码行不翻译
12
+ - **句子分批翻译**:长思考链按句子分批串行翻译,本地小模型也能保持质量
13
+ - **流式输出**:思考过程中译文逐批出现,展开 Think 行可对照原文
14
+ - **失败韧性**:host 请求 3 次退避重试 + 浏览器直连兜底,失败结果不缓存
15
+
16
+ ## 安装
17
+
18
+ ```bash
19
+ # 方式一:从 GitHub 安装(推荐)
20
+ dsh plugin --profile web add https://github.com/<your-name>/dsh-think-translate
21
+ # 然后重启 web
22
+
23
+ # 方式二:手动(junction + patch)
24
+ # 1. 链接包到 profile 的 node_modules
25
+ New-Item -ItemType Junction -Path "$HOME\.dsh\profiles\node_modules\dsh-think-translate" `
26
+ -Target "<此仓库路径>"
27
+ # 2. 在 "$HOME\.dsh\profiles\web\cordis.patch.yml" 加入:
28
+ # - insert:
29
+ # - id: dsh-think-translate
30
+ # name: dsh-think-translate
31
+ # 3. 重启 web
32
+ ```
33
+
34
+ ## 使用
35
+
36
+ 1. 打开 **设置 → 思考链翻译**
37
+ 2. 选择**目标语言**(比如日本語)——设置面板/思考链/任务卡片全部切换为该语言
38
+ 3. 选择**首选提供方**:
39
+ - **本地部署模型(Ollama)**:首次选择时显示下载按钮(qwen2.5:7b / 14b 或自定义),下载完成后自动启用;模型下拉旁 "+" 可随时下载更多
40
+ - **google gtx / bing**:开箱即用(自动走系统代理/VPN)
41
+ 4. 发消息让模型思考,展开 Think 行查看译文
42
+
43
+ ## 工作原理
44
+
45
+ ```
46
+ 浏览器 → POST /_xlate/translate(同源,无 CORS)
47
+ → host 供应商链(fail-open):
48
+ openai 兼容(本地 Ollama,Node fetch 直连回环)
49
+ → google gtx(Node https + CONNECT 隧道走系统代理)
50
+ → bing(curl form)
51
+ → 失败回退浏览器直连
52
+ ```
53
+
54
+ - **host 半边**(`lib/index.js`):供应商适配器、API Key、缓存(LRU 600)、`/_xlate/models` 模型列表、`/_xlate/model/pull` + `pull-status` 模型下载管理(完成后自动配置启用)
55
+ - **client 半边**(`lib/client.js`):8 语言 UI、句子分批翻译、流式 Think 行、localStorage 持久化
56
+ - 纯显示层:原文完整保留在会话日志与模型上下文中
57
+
58
+ ## 开发
59
+
60
+ - 无需构建:`lib/client.js` 是浏览器 bundle(源码即产物),`lib/index.js` 是 host ESM
61
+ - 修改 client 后刷新页面即生效;修改 host 后需重启 web
62
+ - 更新 8 语言文案:编辑 `lib/client.js` 中的 `UI_TEXT` 字典
63
+
64
+ ## License
65
+
66
+ MIT
@@ -0,0 +1,6 @@
1
+ # dsh-think-translate bundle patch — inserts the plugin row into a profile's
2
+ # composition. The row references the package by name so Node resolution finds
3
+ # the installed code (installed via `dsh plugin add` or pnpm).
4
+ - insert:
5
+ - id: dsh-think-translate
6
+ name: dsh-think-translate