fix: add STT timeout, move finally restart to thread, guard exit on recording
- Set OpenAI client timeout=30s in transcribe_audio() — default 600s blocks _voice_processing for 10 min if Groq/OpenAI stalls - Move _voice_start_recording in _voice_stop_and_transcribe finally block to a daemon thread (same pattern as Ctrl+B handler and process_loop) - Add _should_exit guard at top of _voice_start_recording so all 4 call sites respect shutdown without individual checks
This commit is contained in:
parent
bcf4513cb3
commit
0a89933f9b
2 changed files with 11 additions and 7 deletions
16
cli.py
16
cli.py
|
|
@ -3544,6 +3544,8 @@ class HermesCLI:
|
|||
|
||||
def _voice_start_recording(self):
|
||||
"""Start capturing audio from the microphone."""
|
||||
if getattr(self, '_should_exit', False):
|
||||
return
|
||||
from tools.voice_mode import AudioRecorder, check_voice_requirements
|
||||
|
||||
reqs = check_voice_requirements()
|
||||
|
|
@ -3691,12 +3693,14 @@ class HermesCLI:
|
|||
# (When transcript IS submitted, process_loop handles restart
|
||||
# after chat() completes.)
|
||||
if self._voice_continuous and not submitted and not self._voice_recording:
|
||||
try:
|
||||
self._voice_start_recording()
|
||||
if hasattr(self, '_app') and self._app:
|
||||
self._app.invalidate()
|
||||
except Exception:
|
||||
pass
|
||||
def _restart_recording():
|
||||
try:
|
||||
self._voice_start_recording()
|
||||
if hasattr(self, '_app') and self._app:
|
||||
self._app.invalidate()
|
||||
except Exception:
|
||||
pass
|
||||
threading.Thread(target=_restart_recording, daemon=True).start()
|
||||
|
||||
def _voice_speak_response(self, text: str):
|
||||
"""Speak the agent's response aloud using TTS (runs in background thread)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue