l2685209197/dsh-pdf-translate ↗★ 0
dsh-pdf-translate
DSH plugin: translate text-based PDFs via DeepSeek or any OpenAI-compatible API, preserving layout, fonts, images and links (editable output PDF, ≤50 pages per task).
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:l2685209197/dsh-pdf-translate说明文档
阅读完整 README ↗使用
工具调用
translate_pdf 工具(agent 可调用):
| 参数 | 必填 | 说明 |
|---|---|---|
input | ✅ | 输入 PDF 绝对路径 |
outputDir | ✅ | 输出目录 |
pageStart / pageEnd | 可选 | 页面范围(1-based),默认全文;单次任务范围 ≤ 50 页(大书可分页段多次翻译) |
langPair | 可选 | 语言对,如 en→zh;默认取配置 |
termbase | 可选 | 术语表文件路径(JSON/TXT) |
配置(设置卡片 / cordis.yml)
| 配置项 | 默认 | 说明 |
|---|---|---|
apiKey | 空 | DeepSeek API Key(secret,不入日志) |
baseUrl | https://api.deepseek.com | OpenAI 兼容端点 |
model | deepseek-chat | 模型名 |
langPair | en→zh | 默认语言对 |
concurrency | 6 | 并发请求数(1-16) |
maxRetries | 3 | 每请求最大重试(429/5xx/超时,指数退避 + Retry-After) |
timeoutMs | 60000 | 单请求超时 |
termbasePath | 空 | 默认术语表路径 |
pythonBin | python | Python 解释器 |
设置卡片(DSH 桌面设置页 → 插件区)以 zh/en 双语渲染:文案经 ctx.locale 注册 settings.pdfTranslate 命名空间词典,跟随应用全局 Language 切换即时中英互换;视觉使用 --dsw-* 主题 token(明暗自动适配)。API Key 为 secret 角色:保存后不再回显值,显示为「已配置」。输入框带可编辑视觉标识(浅灰底色 + 可见边框 + 聚焦蓝环 + 每字段示例占位符)。
直连 CLI(不经 DSH 应用)
仓库内置两个脚本直接复用生产流水线(与 translate_pdf 工具完全同路径):
### 配置(设置卡片 / cordis.yml)
| 配置项 | 默认 | 说明 |
|---|---|---|
| `apiKey` | 空 | DeepSeek API Key(secret,不入日志) |
| `baseUrl` | `https://api.deepseek.com` | OpenAI 兼容端点 |
| `model` | `deepseek-chat` | 模型名 |
| `langPair` | `en→zh` | 默认语言对 |
| `concurrency` | 6 | 并发请求数(1-16) |
| `maxRetries` | 3 | 每请求最大重试(429/5xx/超时,指数退避 + `Retry-After`) |
| `timeoutMs` | 60000 | 单请求超时 |
| `termbasePath` | 空 | 默认术语表路径 |
| `pythonBin` | `python` | Python 解释器 |
设置卡片(DSH 桌面设置页 → 插件区)以 zh/en 双语渲染:文案经 `ctx.locale` 注册 `settings.pdfTranslate` 命名空间词典,跟随应用全局 Language 切换即时中英互换;视觉使用 `--dsw-*` 主题 token(明暗自动适配)。API Key 为 secret 角色:保存后不再回显值,显示为「已配置」。输入框带可编辑视觉标识(浅灰底色 + 可见边框 + 聚焦蓝环 + 每字段示例占位符)。