Skip to content

Commit

Permalink
Troubleshooting timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Oct 3, 2023
1 parent 75f7819 commit 87fed73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion neon_minerva/integration/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, prompts: List[str], lang: str = "en-us", bus_config: dict = N
self.test_audio = audio
self._tts = OVOSTTSFactory.create() if audio else None
self._prompts = prompts # TODO: Handle prompt metadata for longer timeouts
self._stt_timeout = 60
self._intent_timeout = 30
self._speak_timeout = 60

Expand Down Expand Up @@ -130,7 +131,7 @@ def send_prompt(self, prompt: str):
audio, _ = self._tts.get_tts(prompt, file_path, lang=self.lang)
resp = self.core_bus.wait_for_response(Message("neon.audio_input",
{"audio_data": encode_file_to_base64_string(file_path),
"lang": self.lang}, context), timeout=30)
"lang": self.lang}, context), timeout=self._stt_timeout)
LOG.info(resp.data)
if prompt not in resp.data['transcripts']:
raise RuntimeError(f"Invalid transcription for '{prompt}': {resp.data['utterances']}")
Expand All @@ -144,6 +145,7 @@ def handle_prompt(self, prompt: str):
# Ensure event state matches expectation
if not self._audio_output_done.is_set():
LOG.warning("Audio output not finished when expected!")
self._audio_output_done.wait(self._speak_timeout)
self._audio_output_done.clear()
self._prompt_handled.clear()
self._last_message = None
Expand Down

0 comments on commit 87fed73

Please sign in to comment.