INNER CODE UNIT · Python
executor
thevickypedia/Jarvis · jarvis/main.py:116
def executor(self) -> None:
"""Calls the listener for actionable phrase and runs the speaker node for response."""
if listener_controls.get_listener_state():
playsound(sound=models.indicators.acknowledgement, block=False)
audio_engine.close(stream=self.audio_stream)
# No confidence during initiation since this will interrupt with listener state
if phrase := listener.listen(sound=False, no_conf=True):
try:
commander.initiator(phrase=phrase)
except Exception as error:
logger.critical(error)
logger.error(traceback.format_exc())
speaker.speak(
text=f"I'm sorry {models.env.title}! I ran into an unknown error. "
"Please check the logs for more information."
)
speaker.speak(run=True)
self.audio_stream = self.open_stream()