feat: add Groq STT support and fix voice mode keybinding

- Add multi-provider STT support (OpenAI > Groq fallback) in transcription_tools
- Auto-correct model selection when provider doesn't support the configured model
- Change voice record key from Ctrl+Space to Ctrl+R (macOS compatibility)
- Fix duplicate transcript echo in voice pipeline
- Add GROQ_API_KEY to .env.example
This commit is contained in:
0xbyt4 2026-03-03 17:17:40 +03:00
parent 1a6fbef8a9
commit ec32e9a540
5 changed files with 173 additions and 225 deletions

11
cli.py
View file

@ -3539,7 +3539,7 @@ class HermesCLI:
self._voice_recorder.start()
self._voice_recording = True
_cprint(f"\n{_GOLD}● Recording...{_RST} {_DIM}(Ctrl+Space to stop, Ctrl+C to cancel){_RST}")
_cprint(f"\n{_GOLD}● Recording...{_RST} {_DIM}(Ctrl+R to stop, Ctrl+C to cancel){_RST}")
def _voice_stop_and_transcribe(self):
"""Stop recording, transcribe via STT, and queue the transcript as input."""
@ -3573,7 +3573,6 @@ class HermesCLI:
if result.get("success") and result.get("transcript", "").strip():
transcript = result["transcript"].strip()
_cprint(f"\n{_GOLD}{_RST} {_BOLD}{transcript}{_RST}")
self._pending_input.put(transcript)
elif result.get("success"):
_cprint(f"{_DIM}No speech detected.{_RST}")
@ -3663,7 +3662,7 @@ class HermesCLI:
tts_status = " (TTS enabled)" if self._voice_tts else ""
_cprint(f"\n{_GOLD}Voice mode enabled{tts_status}{_RST}")
_cprint(f" {_DIM}Ctrl+Space to start/stop recording{_RST}")
_cprint(f" {_DIM}Ctrl+R to start/stop recording{_RST}")
_cprint(f" {_DIM}/voice tts to toggle speech output{_RST}")
_cprint(f" {_DIM}/voice off to disable voice mode{_RST}")
@ -3703,7 +3702,7 @@ class HermesCLI:
_cprint(f" Mode: {'ON' if self._voice_mode else 'OFF'}")
_cprint(f" TTS: {'ON' if self._voice_tts else 'OFF'}")
_cprint(f" Recording: {'YES' if self._voice_recording else 'no'}")
_cprint(f" Record key: Ctrl+Space")
_cprint(f" Record key: Ctrl+R")
_cprint(f"\n {_BOLD}Requirements:{_RST}")
for line in reqs["details"].split("\n"):
_cprint(f" {line}")
@ -4715,7 +4714,7 @@ class HermesCLI:
def _get_placeholder():
if cli_ref._voice_recording:
return "recording... Ctrl+Space to stop, Ctrl+C to cancel"
return "recording... Ctrl+R to stop, Ctrl+C to cancel"
if cli_ref._voice_processing:
return "transcribing..."
if cli_ref._sudo_state:
@ -4735,7 +4734,7 @@ class HermesCLI:
if cli_ref._agent_running:
return "type a message + Enter to interrupt, Ctrl+C to cancel"
if cli_ref._voice_mode:
return "type or Ctrl+Space to record"
return "type or Ctrl+R to record"
return ""
input_area.control.input_processors.append(_PlaceholderProcessor(_get_placeholder))