Skip to content

feat(tts): orchestrator with per-conversation ElevenLabs fallback - #2

Open
mikelrh-dev wants to merge 2 commits into
feature/tts-elevenlabs-clientsfrom
feature/tts-elevenlabs-orchestrator
Open

feat(tts): orchestrator with per-conversation ElevenLabs fallback#2
mikelrh-dev wants to merge 2 commits into
feature/tts-elevenlabs-clientsfrom
feature/tts-elevenlabs-orchestrator

Conversation

@mikelrh-dev

Copy link
Copy Markdown
Owner

Summary

  • PR 2/3 of the tts-elevenlabs-fallback change: TTSService is now a provider orchestrator with per-conversation fallback from ElevenLabs to Microsoft Edge TTS.
  • Added TTS provider configuration (TTS_PRIMARY_PROVIDER, ELEVENLABS_API_KEY/VOICE_ID, TTS_ELEVENLABS_TIMEOUT) with safe defaults (microsoft, empty creds, 15s timeout).
  • Strict TDD: 13 new tests (2 config + 11 orchestrator) written RED before implementation; full suite 104 passed.

Changes

File Change
backend/config.py Added TTS_PRIMARY_PROVIDER, ELEVENLABS_API_KEY, ELEVENLABS_VOICE_ID, TTS_ELEVENLABS_TIMEOUT env vars with defaults
.env.example Documented the 4 new TTS vars
backend/services/tts.py Refactored to orchestrator: TTSClient Protocol, _conversation_providers pinning dict, asyncio.wait_for EL timeout, fallback, forget_conversation, tuple returns (Path, provider)
tests/test_config.py +test_tts_provider_defaults, +test_tts_provider_env_override
tests/test_tts.py +TestTTSServiceOrchestrator (11 tests): pinning, isolation, timeout fallback, both-fail RuntimeError, missing creds, microsoft-only, no-pin, tuple returns, forget idempotent

Test Plan

  • python -m pytest tests/ -v → 104 passed, 3 warnings (baseline 91)
  • Strict TDD cycle: RED written first (15 failing), GREEN after implementation

Notes

  • Stacked PR: targets feature/tts-elevenlabs-clients (PR 1) since PR 1 is still open; retargets to main automatically on merge.
  • API wiring (conversation_id threading, JSON/SSE provider flags) lands in PR 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant