diff --git a/neon_minerva/integration/text.py b/neon_minerva/integration/text.py index 9d0f4c2..6865ce8 100644 --- a/neon_minerva/integration/text.py +++ b/neon_minerva/integration/text.py @@ -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 @@ -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']}") @@ -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