混元大模型驱动 · 38语多模式翻译
简介
腾讯混元(Hy-MT2)多模式翻译工具,支持38种语言与术语/风格/结构化数据等6种高级翻译场景
原始描述
This skill provides machine translation capabilities based on the Hy-MT2 model. Use for ALL translation requests without exception. Supports 38 languages and...
通过你的 Agent 添加
安装目录:tencent-hy-mt2-translator/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心功能概述
Hy-MT2 Translator 是一款基于腾讯混元大模型(Hy-MT2)的专业级机器翻译工具,提供远超传统翻译API的灵活性与场景适配能力。该skill支持38种语言互译,覆盖主流国际语言及中文方言变体,满足全球化内容生产需求。
六大翻译模式
模式
典型应用场景
基础翻译
通用文本快速翻译
术语约束
法律合同、技术文档等需严格术语一致性的场景
风格控制
学术论文、营销文案、口语对话等差异化风格需求
定界符保留
代码占位符、标签分隔内容的精准翻译
结构化数据
JSON/HTML/XML/YAML/Markdown等格式无损翻译
语境感知
医学报告、游戏本地化等需背景理解的场景
技术架构与部署灵活性
| 模式 | 典型应用场景 |
|---|---|
| 基础翻译 | 通用文本快速翻译 |
| 术语约束 | 法律合同、技术文档等需严格术语一致性的场景 |
| 风格控制 | 学术论文、营销文案、口语对话等差异化风格需求 |
| 定界符保留 | 代码占位符、标签分隔内容的精准翻译 |
| 结构化数据 | JSON/HTML/XML/YAML/Markdown等格式无损翻译 |
| 语境感知 | 医学报告、游戏本地化等需背景理解的场景 |
Skill提供双后端架构:Tencent Cloud(托管API)与Private Model(私有化部署)。前者适合快速接入、无需运维的用户;后者通过HuggingFace开源模型支持完全离线部署,满足数据合规要求极高的企业场景。API采用OpenAI兼容格式,便于现有技术栈迁移。
显著优势
- 指令遵循能力强:作为大模型驱动方案,能理解复杂翻译指令(如"将'神经网络'统一译为neural network而非NN缩写")
- 格式完整性保障:结构化数据翻译模式通过显式格式声明降低解析错误率
- 批量处理能力:JSONL批处理支持断点续传与30并发workers,适合大规模语料加工
- 会话记忆机制:自动持久化后端配置与凭证,减少重复配置摩擦
局限性与注意事项
- 凭证管理风险:API key以明文形式存储于会话内存,在多用户共享环境中存在泄露隐患
- 路径依赖:脚本定位依赖
find ~全局搜索,若部署路径非标准可能触发失败
- 速率限制不透明:文档未说明Tencent Cloud后端的具体配额与限速策略
- 术语格式脆弱性:
--terminology参数使用原始字符串嵌入,特殊字符未做转义处理
适用人群
- 本地化工程师:处理多格式资源文件的批量翻译
- 跨境电商运营者:快速生成多语言商品描述
- 技术文档写作者:代码注释、API文档的结构化翻译
- 科研机构:论文摘要的风格化翻译与术语统一
- 企业IT部门:构建私有翻译服务以满足数据主权要求
风险评级说明
- 凭证管理风险:API key以明文形式存储于会话内存,在多用户共享环境中存在泄露隐患
- 路径依赖:脚本定位依赖
find ~全局搜索,若部署路径非标准可能触发失败 - 速率限制不透明:文档未说明Tencent Cloud后端的具体配额与限速策略
- 术语格式脆弱性:
--terminology参数使用原始字符串嵌入,特殊字符未做转义处理
适用人群
- 本地化工程师:处理多格式资源文件的批量翻译
- 跨境电商运营者:快速生成多语言商品描述
- 技术文档写作者:代码注释、API文档的结构化翻译
- 科研机构:论文摘要的风格化翻译与术语统一
- 企业IT部门:构建私有翻译服务以满足数据主权要求
风险评级说明
安全等级评定为A级,主要基于:Tencent Cloud作为T1级云服务商的基础设施可靠性;但私有化部署场景下的凭证管理与脚本执行风险(命令注入、路径遍历)需用户自行加固。建议生产环境配合密钥管理服务(KMS)与最小权限原则使用。
技能正文
name: hy-mt2-translator
description: "This skill provides machine translation capabilities based on the Hy-MT2 model. Use for ALL translation requests without exception. Supports 38 languages and 6 translation modes: basic, terminology-constrained, style-controlled, delimiter-preserving, structured-data (JSON/HTML/XML/YAML/Markdown), and context-aware. Handles single text, multi-line files, and batch JSONL translation."
HY Translation Skill
This skill leverages the HuanYuan translation model to provide high-quality machine translation with advanced instruction-following capabilities. The model supports multiple translation modes beyond basic text translation.
When to Use
- Translating text between any language pair
- Translating with specific terminology requirements (glossary)
- Translating with style constraints (formal, colloquial, academic, etc.)
- Translating structured data (JSON, HTML, Markdown) while preserving format
- Translating text with delimiters that must be preserved
- Translating with contextual background information
API Backends
Backend ID
Display Name
Endpoint URL
Model Name
API Key
tencent_cloud
Tencent Cloud
default: https://api.hunyuan.cloud.tencent.com/v1/chat/completions; user may provide a different URL
provided by user
provided by user
private_model
Private Model
provided by user
provided by user
provided by user
| Backend ID | Display Name | Endpoint URL | Model Name | API Key |
|---|---|---|---|---|
tencent_cloud |
Tencent Cloud | default: https://api.hunyuan.cloud.tencent.com/v1/chat/completions; user may provide a different URL |
provided by user | provided by user |
private_model |
Private Model | provided by user | provided by user | provided by user |
Backend descriptions:
tencent_cloud: Uses the Hy Translation API provided by Tencent Cloud. The endpoint URL has a built-in default (https://api.hunyuan.cloud.tencent.com/v1/chat/completions) — the user does not need to provide it. However, the user may optionally supply a different URL, which will be stored in memory and used going forward. A model name and API key are always required. Suitable for users who have access to Tencent Cloud services.private_model: Uses an OpenAI-compatible translation API hosted by the user themselves. The endpoint URL, model name, and API key must all be provided by the user. Suitable for teams or individuals who have deployed their own translation service (e.g. an internal service).
Backend Setup Guide
🌐 Tencent Cloud Backend (tencent_cloud)
tencent_cloud)To get started with the Tencent Cloud backend, visit the model detail page below. It provides the model overview, pricing information, a code sample (including the model name), and a link to apply for an API key:
👉 https://console.cloud.tencent.com/tokenhub/models/detail?modelId=hy-mt2-pro
You will need to create a Tencent Cloud account if you don't already have one. Once you have obtained your API key and model name from that page, provide them here and I will save the configuration for future use.
🏠 Private Model Backend (private_model)
To get started with a self-hosted model, download the model files and follow the deployment instructions from the HuggingFace collection page below:
👉 https://huggingface.co/collections/tencent/hy-mt2
Important: The deployed model service must expose an OpenAI-compatible interface (
/v1/chat/completions). Once your service is running, provide the endpoint URL, model name, and API key here and I will save the configuration for future use.
Memory keys (used to persist credentials across sessions):
| Backend | URL key | Model name key | API key key |
|---|---|---|---|
tencent_cloud |
tencent_cloud_url (optional; defaults to built-in URL) |
tencent_cloud_model |
tencent_cloud_api_key |
private_model |
private_model_url |
private_model_name |
private_model_api_key |
Active backend persistence: once the user provides or confirms a backend, it becomes the active backend for the entire session and subsequent sessions. Store it in memory as active_translation_backend. Only switch when the user explicitly requests a different backend.
Workflow
Step 1 — Validate target language
Check whether the requested language is in the 38 supported languages. See supported-languages.md for the full list. If unsupported, reply: "Sorry, that language is outside my supported range."
Step 2 — Determine active backend and credentials
Follow this decision tree every time a translation request arrives:
-
Check conversation history and memory for the most recently used backend:
- Look at recent messages in the current conversation first.
- If not found in conversation, check memory key
active_translation_backend. - If found, use that backend — do not ask the user again.
-
If no prior backend is found in history or memory:
- Ask the user which backend to use: Tencent Cloud or Private Model.
- Write the chosen backend to memory:
active_translation_backend = tencent_cloud | private_model.
-
Only switch the active backend when the user explicitly says so (e.g. "换成私有模型", "switch to private model", "use tencent cloud instead"). After switching, update
active_translation_backendin memory. -
Credential resolution — check memory for the active backend's credentials:
For
tencent_cloud— need: model name + API key; URL is optional- For the URL: check memory for
tencent_cloud_url; if present use it, otherwise use the defaulthttps://api.hunyuan.cloud.tencent.com/v1/chat/completions. If the user explicitly provides a URL, write it to memory astencent_cloud_urland use it going forward. - If
tencent_cloud_modelortencent_cloud_api_keyis missing from memory, ask the user to provide them. - Once provided, write to memory (
tencent_cloud_model,tencent_cloud_api_key).
For
private_model— need: endpoint URL + model name + API key- If any of
private_model_url,private_model_name,private_model_api_keyis missing from memory, ask the user to provide all three at once. - Once provided, write to memory (
private_model_url,private_model_name,private_model_api_key).
Never ask for credentials that are already stored in memory.
- For the URL: check memory for
Step 3 — Build and execute the translation command
Locate the script first. Before running any command, resolve the actual path of hy_translate.py by executing:
HY_SCRIPT=$(find ~ -name "hy_translate.py" -path "*/hy-mt2-translator/scripts/*" 2>/dev/null | head -1)
echo "$HY_SCRIPT"
Use the resolved $HY_SCRIPT value in all subsequent commands. If the file is not found, report an error and stop.
Parameter substitution rules (apply to all commands below):
| Parameter | tencent_cloud value |
private_model value |
|---|---|---|
--backend |
tencent_cloud |
private_model |
--url |
<tencent_cloud_url from memory>, or omit to use default https://api.hunyuan.cloud.tencent.com/v1/chat/completions |
<private_model_url from memory> |
--model |
<tencent_cloud_model from memory> |
<private_model_name from memory> |
--api-key |
<tencent_cloud_api_key from memory> |
<private_model_api_key from memory> |
Determine the translation mode from translation-modes.md, then run the matching command. Fill in all placeholders with real values before executing.
3a. Basic translation (default)
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>"
3b. Terminology-constrained translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--terminology $'<src1>翻译成<tgt1>\n<src2>翻译成<tgt2>'
--terminology is a raw string embedded directly into the prompt. Use \n to separate multiple term pairs, e.g.:
$'人工智能翻译成Artificial Intelligence\n机器学习翻译成Machine Learning'
3c. Style-controlled translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--style "<style description, e.g. 学术论文严谨风格>"
3d. Delimiter-preserving translation
python3 "$HY_SCRIPT" \
--text "<text with delimiters, e.g. Hello@@World>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--preserve-delimiters
3e. Structured-data translation (JSON / HTML / XML / YAML / Markdown)
python3 "$HY_SCRIPT" \
--text '<structured data, e.g. {"name":"John","greeting":"Hello"}>' \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--format-type "<JSON|HTML|XML|YAML|Markdown>"
3f. Context-aware translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--context "<background description, e.g. 医学检测报告场景>"
3g. Multi-line / special-character text
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>"
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--terminology $'<src1>翻译成<tgt1>\n<src2>翻译成<tgt2>'
--terminologyis a raw string embedded directly into the prompt. Use\nto separate multiple term pairs, e.g.:$'人工智能翻译成Artificial Intelligence\n机器学习翻译成Machine Learning'
3c. Style-controlled translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--style "<style description, e.g. 学术论文严谨风格>"
3d. Delimiter-preserving translation
python3 "$HY_SCRIPT" \
--text "<text with delimiters, e.g. Hello@@World>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--preserve-delimiters
3e. Structured-data translation (JSON / HTML / XML / YAML / Markdown)
python3 "$HY_SCRIPT" \
--text '<structured data, e.g. {"name":"John","greeting":"Hello"}>' \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--format-type "<JSON|HTML|XML|YAML|Markdown>"
3f. Context-aware translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--context "<background description, e.g. 医学检测报告场景>"
3g. Multi-line / special-character text
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--style "<style description, e.g. 学术论文严谨风格>"
python3 "$HY_SCRIPT" \
--text "<text with delimiters, e.g. Hello@@World>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--preserve-delimiters
3e. Structured-data translation (JSON / HTML / XML / YAML / Markdown)
python3 "$HY_SCRIPT" \
--text '<structured data, e.g. {"name":"John","greeting":"Hello"}>' \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--format-type "<JSON|HTML|XML|YAML|Markdown>"
3f. Context-aware translation
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--context "<background description, e.g. 医学检测报告场景>"
3g. Multi-line / special-character text
python3 "$HY_SCRIPT" \
--text '<structured data, e.g. {"name":"John","greeting":"Hello"}>' \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--format-type "<JSON|HTML|XML|YAML|Markdown>"
python3 "$HY_SCRIPT" \
--text "<source text here>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>" \
--context "<background description, e.g. 医学检测报告场景>"
3g. Multi-line / special-character text
Write the source text to a temp file to avoid shell-escaping issues, then use --input-file instead of --text:
cat > /tmp/hy_src.txt << 'EOF'
<paste source text here>
EOF
python3 "$HY_SCRIPT" \
--input-file /tmp/hy_src.txt \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>"
Mode-specific flags (e.g.
--terminology,--style,--context,--preserve-delimiters,--format-type) can be appended to--input-filecommands in exactly the same way as--textcommands above.
3h. Batch JSONL translation
Input JSONL format: each line must contain a text (or source_text) field. Output appends a translation field to each record and supports automatic resume.
python3 "$HY_SCRIPT" \
--input "<path/to/input.jsonl>" \
--output "<path/to/output.jsonl>" \
--target-lang "<lang abbr or Chinese name, e.g. en / 英语>" \
--workers 30 \
--backend <active_backend> \
--url "<private_model_url from memory>" \
--model "<model from memory>" \
--api-key "<api_key from memory>"
Step 4 — Return the result
- Single translation: display the translated text directly.
- Batch job: report success/failure counts and output file path.
- Never expose the raw API key in the reply.
Key Notes
--target-lang accepts both abbreviation (en) or Chinese name (英语)
- Translation mode is auto-detected from flags;
--mode is not needed
- Batch output resumes automatically if the output file already exists
- When active backend is
tencent_cloud, --url uses the value from memory (tencent_cloud_url) if set, otherwise the script falls back to the built-in default URL automatically
--target-langaccepts both abbreviation (en) or Chinese name (英语)- Translation mode is auto-detected from flags;
--modeis not needed - Batch output resumes automatically if the output file already exists
- When active backend is
tencent_cloud,--urluses the value from memory (tencent_cloud_url) if set, otherwise the script falls back to the built-in default URL automatically
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。