Skip to content

Commit

Permalink
Refactor Twilio ASR and TTS behavior for better modularity and defaul…
Browse files Browse the repository at this point in the history
…t handling

- Fix KeyError when calling a bot that has no asr/tts selected
- Remove the `get_twilio_tts_voice` and `get_twilio_asr_language` functions.
- Add `resolve_twilio_asr_language` and `resolve_twilio_tts_voice` functions to handle language and voice determination.
- Refactor `create_voice_call_response` and `resp_say_or_tts_play` to use new resolve functions.
- Update constants for default and supported ASR languages and TTS voices.
  • Loading branch information
devxpy committed Jul 25, 2024
1 parent 94cdb47 commit 9ed0709
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 74 deletions.
6 changes: 0 additions & 6 deletions daras_ai_v2/twilio_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def __init__(
text: str = None,
audio_url: str = None,
):
from routers.twilio_api import get_twilio_tts_voice, get_twilio_asr_language

self.convo = convo

Expand All @@ -149,11 +148,6 @@ def __init__(

super().__init__()

self.use_gooey_asr = self.saved_run.state.get(
"asr_model"
) or not get_twilio_asr_language(self.bi)
self.use_gooey_tts = not get_twilio_tts_voice(self.bi)

def get_input_text(self) -> str | None:
return self._text

Expand Down
Loading

0 comments on commit 9ed0709

Please sign in to comment.