Install
openclaw skills install xunfei-voice-reply语音回复技能 - 使用讯飞 TTS 生成语音并发送到飞书。当需要用语音回复用户消息时使用。触发词:用语音、语音回复、切换语音模式、语音模式。
openclaw skills install xunfei-voice-reply用户可以通过以下命令切换回复模式:
切换时更新 USER.md 的 回复模式 字段。
当 USER.md 中 回复模式: voice 时:
1. 生成文本回复内容
2. 调用 scripts/voice-reply.js 生成语音
3. 使用 message 工具发送 opus 文件到飞书
4. 返回 NO_REPLY(语音已发送)
node scripts/voice-reply.js "要说的文本"
成功输出:
VOICE_READY:/tmp/openclaw/voice-reply.opus
message({
action: 'send',
channel: 'feishu',
target: 'user:<open_id>',
media: '/tmp/openclaw/voice-reply.opus'
})
编辑 config.json 修改发音人:
{
"voice": "x4_xiaoyan",
"availableVoices": {
"x4_xiaoyan": "晓燕 - 女声,温柔",
"x4_lingyouyou": "凌悠 - 童声",
"x4_yezi": "叶子 - 女声,活泼"
}
}
export XUNFEI_APP_ID="你的应用ID"
export XUNFEI_API_KEY="你的API Key"
export XUNFEI_API_SECRET="你的API Secret"
export XUNFEI_VOICE="x4_lingyouyou" # 可选,覆盖 config.json
xunfei-voice-reply/
├── SKILL.md # 本文件
├── config.json # 用户配置(音色、参数)
├── scripts/
│ └── voice-reply.js # 语音生成脚本
├── lib/
│ ├── tts-core.js # 讯飞 TTS 核心模块
│ └── tts-config.js # 配置读取
└── references/
└── setup.md # 环境配置说明
使用讯飞 WebSocket TTS API:
音频文件输出到 /tmp/openclaw/(OpenClaw 标准临时目录),确保在 message 工具允许的路径内。
回复模式存储在 USER.md:
- **Notes:**
- **回复模式**: text # text 或 voice
每次 session 启动时读取,切换时更新。
使用此技能前,必须在 AGENTS.md 中添加语音回复流程:
## 🎤 Voice Reply (讯飞语音)
Check `USER.md` Notes for `回复模式`:
- If `回复模式: voice` → use voice for replies
- If `回复模式: text` (or not set) → use text
### Voice Reply Flow
1. Generate text response
2. Run: `node ~/.agents/skills/xunfei-voice-reply/scripts/voice-reply.js "text"`
3. Send the Opus file via `message` tool
4. Reply with `NO_REPLY`
### Trigger Words
- "用语音" / "语音回复" / "切换语音模式"