{"skill":{"slug":"telegram-multilingual-voice-reply","displayName":"Telegram Multilingual Voice Reply","summary":"Smart Telegram reply workflow for OpenClaw: if the user sends text, reply with text; if the user sends a voice note/audio, transcribe locally using the insta...","description":"---\nname: telegram-multilingual-voice-reply\ndescription: \"Smart Telegram reply workflow for OpenClaw: if the user sends text, reply with text; if the user sends a voice note/audio, transcribe locally using the installed mlx_audio (default Qwen3-ASR on Apple Silicon), then generate a meaningful reply in the same language. Send back a Telegram voice note with a caption so the user receives ONE message containing both voice+text (the caption text must match the voice content exactly). Follow the input language (Chinese→Chinese, English→English) unless the user explicitly requests a different language.\"\n---\n\n# Telegram Multilingual Voice Reply（多语言语音智能回复）\n\n目标：在 Telegram 跟 OpenClaw 聊天时实现“语音优先 + 多语言跟随”的智能回复：\n\n- **你发文字** → 默认只发**文字回复**（不触发 ASR；默认也不触发 TTS）。\n- **你发语音** → 本地 STT 转写后理解语义，生成“有意义的回复”。默认用 **一条 Voice Message + caption** 发送（语音+文字同条，且内容一致）。\n- **语言跟随**：你用中文我用中文；你用英文我用英文；除非你明确要求指定语言（也支持方言/口吻要求，但 TTS 受模型限制）。\n\n## Default models\n\n- STT 默认：`mlx-community/Qwen3-ASR-0.6B-8bit`\n- （可选）Forced alignment：`mlx-community/Qwen3-ForcedAligner-0.6B-8bit`\n\n> 需要模型清单/更多上游用法：`references/qwen3-asr-notes.md`\n\n## How to use (agent workflow)\n\n### A) 输入是文字（text message）\n\n- **永不触发 ASR**。\n- 默认只发文字回复。\n- 只有当用户明确说“用语音回复/发语音/voice reply”时：\n  - 生成回复文本 `reply_text`\n  - 生成 voice note（见下方“Telegram 单条消息”）\n  - 发送 **一条** Voice Message（caption=`reply_text`，且与语音内容一致）\n\n### B) 输入是语音（voice note / audio）\n\n- 默认必走 ASR（否则无法“智能回复”）。\n- 然后根据用户意图决定是否触发 TTS：\n  - 用户说“只要文字/文字回复/不要语音” → **ASR + 文字回复**（不 TTS）。\n  - 否则（默认真实场景） → **ASR + 生成回复 + 单条 voice+caption**（走 TTS）。\n\n#### 语音→转写（本地、Apple Silicon）\n\n```bash\npython3 scripts/mlx_asr.py --audio /path/to/audio.ogg --language Chinese\n```\n\n> 注：Telegram 常见是 ogg/opus。`mlx_asr.py` 已支持 CLI fallback，并会在需要时用 ffmpeg 转 wav。\n\n#### Telegram 单条消息（语音 + 文字在同一条）\n\nTelegram 支持给 voice note 附带 caption，使得“语音条 + 下方文字”显示为**同一条消息**（你截图里的效果）。\n\n1) 用 `scripts/mlx_tts_voice.py` 生成 Telegram 友好的 `.ogg/opus`：\n\n```bash\npython3 scripts/mlx_tts_voice.py --text \"<reply_text>\" --out /tmp/reply.ogg\n```\n\n2) 用 OpenClaw `message` 工具发送（voice note + caption）：\n- `asVoice: true`\n- `path/filePath`: 上一步生成的 `reply.ogg`\n- `caption`: **同一段 reply_text**（必须与语音内容一致）\n\n> 说明：OpenClaw 的 `tts` 工具通常会把语音作为单独消息发送，无法保证 caption 同条承载。\n\n## Options / overrides\n\n- 用户说“只用文字回复/不要语音” → 只发文字。\n- 用户说“只用语音回复/不要文字” → 只发语音（仍然保持内容一致）。\n- 用户说“用英文/用中文回复” → 覆盖默认语言跟随策略。\n\n## Troubleshooting\n\n- `failed to import mlx_audio`：当前 `python3` 环境里没有安装到 `mlx_audio`。请用安装 `mlx_audio` 的同一个解释器/venv 运行。\n- 音频格式问题：Telegram 常见 voice note 是 `ogg/opus`。如转写失败，优先把音频转成 wav 再试（或确保系统具备相应解码能力）。\n","tags":{"latest":"0.1.0"},"stats":{"comments":0,"downloads":1139,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1771666909514,"updatedAt":1778992056058},"latestVersion":{"version":"0.1.0","createdAt":1771666909514,"changelog":"Voice-first Telegram smart replies with local MLX-Audio STT, multilingual follow, and single-message voice+caption output.","license":null},"metadata":null,"owner":{"handle":"pengling9405","userId":"s176phvbgtnam19dxeqxe534an884krc","displayName":"0x1","image":"https://avatars.githubusercontent.com/u/224269574?v=4"},"moderation":null}