refactor: unify voice transcription config across all channels

- Move transcriptionProvider to global channels config (not per-channel)
- ChannelManager auto-resolves API key from matching provider config
- BaseChannel gets transcription_provider attribute, no more getattr hack
- Remove redundant transcription fields from WhatsAppConfig
- Update README: document transcriptionProvider, update provider table

Made-with: Cursor
This commit is contained in:
Xubin Ren
2026-04-06 06:07:30 +00:00
parent 7b7a3e5748
commit 35dde8a30e
6 changed files with 21 additions and 15 deletions
+3 -4
View File
@@ -166,10 +166,9 @@ async def test_group_policy_mention_accepts_mentioned_group_message():
@pytest.mark.asyncio
async def test_voice_message_transcription_uses_media_path():
"""Voice messages are transcribed when media path is available."""
ch = WhatsAppChannel(
{"enabled": True, "transcriptionProvider": "openai", "transcriptionApiKey": "sk-test"},
MagicMock(),
)
ch = WhatsAppChannel({"enabled": True}, MagicMock())
ch.transcription_provider = "openai"
ch.transcription_api_key = "sk-test"
ch._handle_message = AsyncMock()
ch.transcribe_audio = AsyncMock(return_value="Hello world")