← 返回 Skills 市场
igloomatics

language-helper

作者 Igloos · GitHub ↗ · v1.2.2 · MIT-0
cross-platform ✓ 安全检测通过
211
总下载
0
收藏
0
当前安装
12
版本数
在 OpenClaw 中安装
/install language-helper
功能描述
Use this skill whenever the user wants to learn how to say something in another language. Triggers include: language tags like 【日语】【英语】【韩语】【法语】【西班牙语】【德语】 fol...
使用说明 (SKILL.md)

language-helper

将中文句子翻译为目标语言,并提供发音语音、简要语法说明和重点词汇。

触发方式

  • 【日语】我今天很累
  • 【英语】这个说法太生硬了
  • 【简洁】【韩语】谢谢你的帮助
  • "用日语怎么说……"
  • "翻译成英语并朗读"

模式

默认模式

返回:

  • 翻译结果
  • 发音语音
  • 简要语法说明
  • 重点词汇
  • 可选替代表达

简洁模式

当用户添加 【简洁】 时,仅返回:

  • 翻译结果
  • 发音语音
  • 关键词注释

环境检查

先检查环境变量 SENSEAUDIO_API_KEY。如果已经存在,直接使用;如果不存在,再提示用户提供 API Key 或先在终端设置环境变量。不要把密钥写进 SKILL.md、脚本源码或提交记录。

首次运行前检查:

  1. 首次运行时 skill 会自动创建 skills/language-helper/.env 模板,用户需填写对应的值
  2. 确认 ffmpeg 已安装

.env 示例:

SENSEAUDIO_API_KEY=your_key

# 以下为飞书语音条功能(可选,不用飞书可不填)
FEISHU_APP_ID=cli_xxx
FEISHU_APP_SECRET=xxx
FEISHU_CHAT_ID=oc_xxx

检查 ffmpeg:

which ffmpeg
# 若未安装:
# macOS: brew install ffmpeg
# Linux: sudo apt install ffmpeg

内置音色映射

始终优先使用用户显式指定的 voice_id。未指定时,根据目标语言选择默认音色。

在当前 SenseAudio key 权限有限时,仅默认使用已确认可用的以下音色:

  • child_0001_b:可爱萌娃,平稳
  • male_0004_a:儒雅道长,平稳
  • male_0018_a:沙哑青年,深情

不要默认选择未确认授权的 VIP / SVIP 音色。若接口返回 403 no access to the specified voice,优先回退到 child_0001_b,而不是重复尝试未授权音色。

LANG_VOICE_MAP:
  ja: male_0004_a
  en: male_0004_a
  zh: male_0004_a
  ko: male_0004_a
  fr: male_0004_a
  es: male_0004_a
  de: male_0004_a

输入解析

从用户输入中提取:

  • 目标语言
  • 是否为 【简洁】 模式
  • 待翻译文本
  • 解释语言

解释语言默认跟随用户输入语言:

  • 用户用中文提问 → 中文解释
  • 用户用英文提问 → 英文解释

语言代码映射:

标签 代码
日语 ja
英语 en
韩语 ko
法语 fr
西班牙语 es
德语 de

执行流程

一次完成以下内容:

  1. 翻译文本
  2. 生成并发送语音
  3. 输出文字讲解

语音发送

优先发送飞书语音条:

python3 skills/language-helper/scripts/main.py send-voice \
  --text "{translated_text}" \
  --lang {lang_code}

若飞书配置缺失,则降级为本地播报:

python3 skills/language-helper/scripts/main.py speak \
  --text "{translated_text}" \
  --lang {lang_code}

若 TTS 失败,继续返回纯文本结果,并说明语音不可用。

API 请求模板

API 地址固定为:

https://api.senseaudio.cn/v1/t2a_v2

重要:先按最小请求体调用官方接口,不要一开始就附带全部可选字段。若接口返回 400 input content type is not supported,优先怀疑请求体结构与官方当前协议不一致,而不是继续切换音色。

语音生成

使用 helper.py synthesize 发送 TTS 请求并把 hex 音频保存到本地。

helper.py 内置以下健壮机制(参考 VoiceMaster 模式):

  1. 文本变体:自动对输入文本生成多种规范化变体(去角色前缀、标点规范化、去特殊标点、纯文本等),依次尝试直到成功。
  2. 请求体变体:对每种文本变体,依次尝试 full → no-audio-setting → no-speed-pitch → minimal 四种请求体。
  3. 自动重试:对 5xx 及网络错误自动重试最多 3 次,带指数退避。
  4. 音色降级:若 403 no access to the specified voice,自动回退到 child_0001_b / male_0004_a / male_0018_a
  5. 调试日志:仅在显式传入 --debug-log 参数时才生成 .debug.json,默认不写入任何日志文件。

方式一:直接文本播报(推荐)

python3 skills/language-helper/scripts/main.py speak \
  --text "{translated_text}" \
  --lang {lang_code} \
  --speed 1.0 \
  --pitch 0

speak 命令会自动:

  1. 将文本写入临时文件
  2. 调用 helper.py synthesize 生成音频
  3. 使用系统播放器(macOS afplay / ffplay)播放

方式二:文件输入合成

python3 skills/language-helper/scripts/main.py synthesize \
  --text-file segment.txt \
  --voice-id male_0004_a \
  --speed 1.0 \
  --pitch 0 \
  --format wav \
  --sample-rate 24000 \
  --output outputs/reply.wav

方式三:多段合并

python3 skills/language-helper/scripts/main.py concat \
  --output outputs/final.wav \
  outputs/segment-01.wav outputs/segment-02.wav

SenseAudio 响应处理

SenseAudio 非流式 TTS 的成功响应为 JSON,其中 data.audiohex 编码的音频数据。处理规则如下:

  1. 先检查 base_resp.status_code 是否为 0
  2. 若成功,读取 data.audio 并按十六进制解码为二进制音频文件。
  3. 使用 extra_info.audio_lengthextra_info.audio_sample_rate 作为结果回执。
  4. data.audio 为空或 status_code0,直接返回 base_resp.status_msg

响应结构参考:

{
  "data": {
    "audio": "hex编码音频",
    "status": 2
  },
  "extra_info": {
    "audio_length": 3500,
    "audio_sample_rate": 44100
  },
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

输出格式

默认模式

🗣 {翻译结果}({发音})

📝 语法解析
• {语法点1}
• {语法点2}

📖 重点词汇
| 单词 | 读音 | 词性 | 释义 |
|------|------|------|------|
| ... | ... | ... | ... |

💡 其他表达
• {替代表达}

简洁模式

🗣 {翻译结果}({发音})

📖 {词1}={含义} | {词2}={含义}

输出要求

  • 翻译应自然、口语化
  • 保留原句语气和语域
  • 日语可附罗马音
  • 韩语可附罗马字
  • 说明语言默认跟随用户输入语言
  • 不展示本地文件路径
  • 若 TTS 失败,继续返回纯文本结果,并说明语音不可用
  • 如果因为套餐权限限制降级到授权音色,明确写出降级原因与最终使用的 voice_id

运行要求

  • 已配置 .env(含 SENSEAUDIO_API_KEY
  • 系统可用 ffmpeg
  • 需要联网调用语音服务
  • 飞书语音条需额外配置 FEISHU_APP_IDFEISHU_APP_SECRETFEISHU_CHAT_ID

限制

  • 当前默认使用单一音色
  • 专业或冷门表达可能不够完全地道
  • 飞书语音条依赖机器人权限
安全使用建议
This skill appears to do what it says: translate text and produce TTS via SenseAudio, with an optional Feishu delivery feature. Before installing: 1) Ensure you trust the SenseAudio service (API calls go to https://api.senseaudio.cn) and be comfortable storing its API key in a local file (skills/language-helper/.env). Do not commit that .env to source control. 2) If you won't use Feishu, you can leave FEISHU_* unset; if you do use it, Feishu credentials are required and will be used to obtain a tenant token and upload/send audio. 3) ffmpeg must be installed for conversion/playback. 4) Note the bundled .claude/settings.local.json that configures allowed WebFetch domains — review it if you have policies about agent network access. Overall the components are proportionate to the feature set; proceed if you trust the TTS provider and follow the guidance above.
功能分析
Type: OpenClaw Skill Name: language-helper Version: 1.2.2 The language-helper skill is a legitimate tool designed for language learning, translation, and text-to-speech (TTS) generation. It interacts with the SenseAudio API (api.senseaudio.cn) for audio synthesis and the Feishu/Lark API (open.feishu.cn) for sending voice messages. The code follows security best practices by using environment variables for sensitive API keys, implementing safe subprocess calls (passing arguments as lists rather than shell strings) for ffmpeg and system audio players, and avoiding external dependencies by using the standard urllib library. No evidence of data exfiltration, malicious execution, or prompt injection was found in the scripts (main.py, helper.py, feishu_api.py) or the documentation (SKILL.md).
能力评估
Purpose & Capability
The skill translates text and produces TTS audio. Requiring a SenseAudio API key and ffmpeg for audio conversion is coherent with that purpose. Optional Feishu credentials (FEISHU_APP_ID/FEISHU_APP_SECRET/FEISHU_CHAT_ID) are present for the 'send-voice' feature and are reasonable.
Instruction Scope
SKILL.md instructs the agent to create/use a local .env, call the SenseAudio TTS endpoint, and optionally call Feishu APIs — all within the stated scope. Minor mismatch: main.py may print a local file path when no player is available (SKILL.md asked not to show local file paths). Also the skill auto-creates a .env template in skills/language-helper/.env which the user must populate; this writes a file containing secrets on disk (expected for local usage but worth noting).
Install Mechanism
No install script or external downloads; code is included in the skill bundle and relies on preinstalled ffmpeg. This is low risk compared to pulling/executing remote archives.
Credentials
Only SENSEAUDIO_API_KEY is required; Feishu credentials are optional. That is proportionate to a TTS + optional messaging feature. Users should be aware the skill expects the API key in a local .env file (written by the skill) which will store secrets on disk — do not commit that file to source control.
Persistence & Privilege
The skill is not always-enabled and does not request elevated system privileges. The repository includes a .claude/settings.local.json file that lists allowed WebFetch domains — this is a local agent settings file bundled with the skill and may influence allowed agent web fetches. Including such a settings file is not inherently malicious, but users should review and be comfortable with those allowed domains.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install language-helper
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /language-helper 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.2
- Dropped requirement for Feishu-related environment variables; now only `SENSEAUDIO_API_KEY` is required. - Clarified that Feishu voice message support is optional, not required for core functionality. - No changes to feature set or workflow; skill behavior remains the same for language learning and pronunciation.
v1.2.1
language-helper 1.2.1 - Updated required environment variables to include FEISHU_APP_ID, FEISHU_APP_SECRET, and FEISHU_CHAT_ID for Feishu voice message features. - Clarified .env configuration instructions with example templates, marking Feishu variables as optional unless using Feishu voice. - Changed debug log behavior: now debug logs are generated only when explicitly passing --debug-log, avoiding unnecessary log files by default. - Improved documentation on first-run environment checks and step-by-step guidance for users.
v1.2.0
language-helper v1.2.0 - Updated environment configuration: Feishu-related environment variables moved from required to optional, reflecting that Feishu integration is now optional. - Clarified requirements: Only SENSEAUDIO_API_KEY and ffmpeg are strictly required for core functionality. - Documentation clean-up: Metadata and environment checks now accurately match feature behavior. - No code changes in this version; documentation only.
v1.1.2
language-helper 1.1.2 - Added custom skill settings file: `.claude/settings.local.json` - Introduced `metadata` section in SKILL.md (category: language; tags: tts, translation, language-learning, senseaudio, feishu) to improve categorization and discovery - No code or runtime behavior changes
v1.1.1
language-helper v1.1.1 - No functional or code changes in this version. - Documentation and configuration remain identical to the previous release.
v1.1.0
language-helper 1.1.0 - No code or documentation changes detected in this version. - Functionality, requirements, and usage remain the same as previous release.
v1.0.9
language-helper 1.0.9 - Added FEISHU_APP_ID, FEISHU_APP_SECRET, and FEISHU_CHAT_ID as optional environment variables in the skill manifest. - No changes to code or functionality; documentation now clarifies the role and optionality of Feishu-related environment variables.
v1.0.8
language-helper 1.0.8 - Removed `.env` from version control to improve security and prevent sensitive information from being stored in the repository. - No functional or behavioral changes in the skill itself.
v1.0.7
- Major update: Improved SenseAudio voice handling and refactored TTS logic for robustness. - Added `helper.py` with resilient synthesis and fallback mechanisms for unsupported voices. - Removed deprecated files: `README.md` and `scripts/tts.py`. - Now restricts audio voices to confirmed available types and clearly documents fallback on permission errors. - Changelog, requirements, and process documentation in SKILL.md greatly expanded and clarified. - Environment check now requires only `SENSEAUDIO_API_KEY` and `ffmpeg` by default.
v1.0.6
version 1.0.6 - No file changes detected in this release. - Documentation remains unchanged. - No behavior or feature updates.
v1.0.4
Initial release of language-helper. - New skill to translate Chinese sentences into target languages with pronunciation audio, concise grammar explanations, and key vocabulary. - Supports triggers including language tags (e.g. 【日语】, 【英语】) and common learning phrases. - Includes both default and brief response modes; brief mode activated by 【简洁】. - On first run, checks for required environment variables and system dependencies (including ffmpeg), with user guidance for setup. - Voice output sent via Feishu voice bar if configured; otherwise, local speech. - Ensures explanations use the user's input language by default.
v1.0.0
- Initial release of "voice-flashcard": an interactive language-learning skill with native voice output. - Supports natural translation from Chinese to Japanese, English, Korean, French, Spanish, or German, with grammar breakdown, vocabulary table, and alternative expressions. - Generates and sends pronunciation audio via SenseAudio TTS and Feishu voice bar integration. - Auto-guides user through required environment setup, including API keys and ffmpeg installation. - Offers detailed and brief response modes, with explanation language matched to the user's input.
元数据
Slug language-helper
版本 1.2.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 12
常见问题

language-helper 是什么?

Use this skill whenever the user wants to learn how to say something in another language. Triggers include: language tags like 【日语】【英语】【韩语】【法语】【西班牙语】【德语】 fol... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 211 次。

如何安装 language-helper?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install language-helper」即可一键安装,无需额外配置。

language-helper 是免费的吗?

是的,language-helper 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

language-helper 支持哪些平台?

language-helper 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 language-helper?

由 Igloos(@igloomatics)开发并维护,当前版本 v1.2.2。

💬 留言讨论