fix(tts): use opus format and enable voice bubbles for feishu and whatsapp (#27366)

* fix(tts): use opus format and enable voice bubbles for feishu and whatsapp

Previously only Telegram received opus output and had `shouldVoice=true`.
Feishu and WhatsApp also support voice-bubble playback and require opus audio,
but were falling back to mp3 with `audioAsVoice=false`.

- Extract VOICE_BUBBLE_CHANNELS set (telegram, feishu, whatsapp)
- resolveOutputFormat: return TELEGRAM_OUTPUT (opus) for all voice-bubble channels
- shouldVoice: enable for all voice-bubble channels, not just telegram
- Update test to cover feishu and whatsapp cases

* Changelog: add TTS voice-bubble channel coverage note

---------

Co-authored-by: Ning Hu <ninghu@Nings-MacBook-Pro.local>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
smthfoxy
2026-02-28 13:41:22 +08:00
committed by GitHub
parent 53a2e72fcb
commit 5350f5b035
3 changed files with 26 additions and 3 deletions

View File

@@ -154,7 +154,7 @@ describe("tts", () => {
});
describe("resolveOutputFormat", () => {
it("selects opus for Telegram and mp3 for other channels", () => {
it("selects opus for voice-bubble channels (telegram/feishu/whatsapp) and mp3 for others", () => {
const cases = [
{
channel: "telegram",
@@ -165,6 +165,24 @@ describe("tts", () => {
voiceCompatible: true,
},
},
{
channel: "feishu",
expected: {
openai: "opus",
elevenlabs: "opus_48000_64",
extension: ".opus",
voiceCompatible: true,
},
},
{
channel: "whatsapp",
expected: {
openai: "opus",
elevenlabs: "opus_48000_64",
extension: ".opus",
voiceCompatible: true,
},
},
{
channel: "discord",
expected: {