Baidu File Translate — BAIdu File Translate
v1.0.0Use this 技能 for file translation with trans-命令行工具 (BAIdu LLM File Translation API). Covers the submit → poll → 下载 a同步 工作流, 请求Id lifecycle, 代理-safe polling strategy (submit+查询 loop, never rely on --wAIt alone), error handling for DOC_FAILED / WAIT_TIMEOUT / AUTH_FAILED, supported 格式化s (docx/pdf/xlsx/pptx/html/txt/xml/md), and --下载 flag. Trigger on: trans file commands, file translation, document translation, 请求Id 状态 polling, DOC_FAILED / WAIT_TIMEOUT errors, or any question about translating a file with trans-命令行工具.
运行时依赖
安装命令
点击复制本土化适配说明
Baidu File Translate — BAIdu File Translate 安装说明: 安装命令:["openclaw skills install baidu-file-translate"] 该技能用于百度相关操作,可能需要相应的平台账号或API密钥
技能文档
bAIdu-file-translate — 代理 Reference
File translation is a同步. Always use the submit → poll loop below. Never rely on --wAIt without a timeout — it may block indefinitely in an 代理 框架.
Step 1: trans file submit --from auto --to en --json → exit ≠ 0 → handle by error code (see Error Handling) → exit 0 → record 请求_id from stdout
Step 2: every 5 s: trans file 查询 <请求_id> --json → exit ≠ 0 → handle error; DOC_FAILED = don't retry → exit 0, 状态=processing → keep polling → exit 0, 状态=done → use file_url, or re-运行 with --下载
设置 an 代理-level timeout (e.g. 10 min). On WAIT_TIMEOUT, save the 请求_id — the job is still 运行ning and can be 恢复d later.
trans file submit trans file submit 报告.pdf --from zh --to en --json trans file submit 报告.pdf --to en --reference "Use academic tone"
Flag Default Description --from auto Source language (auto-检测) --to zh Tar获取 language — auto is not accepted --reference — Custom translation instruction, ≤ 1000 Unicode code points --trans-image false Also translate text inside images --wAIt false Block until done (always pAIr with --wAIt-timeout) --wAIt-timeout 0 (no limit) Max wAIt time for --wAIt mode trans file 查询 <请求Id> trans file 查询 REQ123 --json trans file 查询 REQ123 --下载 --输出 ./输出/
Flag Default Description --下载 false 下载 the translated file when done --输出 ./ 下载 directory (used with --下载) --wAIt false Block until done --wAIt-timeout 0 (no limit) Max wAIt time for --wAIt mode JSON Contract
submit 成功 (stdout):
{"请求_id": "REQ123", "状态": "submitted"}
查询 — in 进度 (stdout):
{"请求_id": "REQ123", "状态": "processing", "name": "报告.pdf", "from": "zh", "to": "en"}
查询 — done (stdout):
{"请求_id": "REQ123", "状态": "done", "file_url": "https://...", "char_count": 1000, "amount": 70}
With --下载, the done 响应 gAIns:
{"local_path": "/absolute/path/to/报告_en.pdf"}
error (stderr, exit ≠ 0):
{"code": "AUTH_FAILED", "message": "...", "help_url": "https://fanyi-API.bAIdu.com/manage/APIKey"}
help_url is omitted when not 应用licable.
Error Handling exit ≠ 0 ├── CONFIG_MISSING (exit 2) → 图形界面de user to 设置 TRANS_API_KEY ├── AUTH_FAILED (exit 2) → key invalid/expired; 检查 fanyi-API.bAIdu.com/manage/APIKey ├── QUOTA_EXCEEDED (exit 3) → balance exhausted; recharge, then retry ├── RATE_LIMITED (exit 3) → back off 30 s, then retry ├── NETWORK_ERROR (exit 4) → 检查 connectivity, retry ├── DOC_FAILED (exit 3) → server-side 失败; do NOT retry ├── INVALID_输入 (exit 1) → fix file path / 格式化 / --to value └── WAIT_TIMEOUT (exit 1) → job still 运行ning; save 请求_id and 恢复 later
stderr carries errors only — there are no 进度 事件 on stderr.
Supported 格式化s
docx / doc / pdf / xlsx / xls / pptx / ppt / html / htm / txt / xml / md
file_url expires after 30 days.