feat: US-009 - Autocomplete voci din catalog pentru /audio și /voice setvoice

- tools/tts.py: +list_voice_names(engine=None), sursă live din tts_voices.json
- src/fast_commands.py: _VOICES statice -> _supertonic_voice_names() din catalog
- discord_bot.py /audio și discord_voice.py /voice setvoice: choices statice -> autocomplete live
- gates rulate: tests PASS (1043 passed, 22 eșecuri preexistente neschimbate), ui/backend review PASS manual
This commit is contained in:
2026-07-11 10:44:04 +00:00
parent 3d5c2a4ace
commit 504e12ac4e
4 changed files with 80 additions and 27 deletions

View File

@@ -712,11 +712,23 @@ Session:
# Audio / TTS
# ---------------------------------------------------------------------------
_VOICES = {"M1", "M2", "M3", "M4", "M5", "F1", "F2", "F3", "F4", "F5"}
_AUDIO_PREFIX = "__AUDIO__:"
_MAX_TTS_CHARS = 3000
def _supertonic_voice_names() -> set[str]:
"""Nume de voci Supertonic din tts_voices.json (import lazy din tools/tts.py)."""
import sys as _sys
_tools_dir = str(TOOLS_DIR)
if _tools_dir not in _sys.path:
_sys.path.insert(0, _tools_dir)
try:
import tts as _tts_mod
return set(_tts_mod.list_voice_names(engine="supertonic"))
except Exception:
return {"M1", "M2", "M3", "M4", "M5", "F1", "F2", "F3", "F4", "F5"}
def cmd_audio(args: list[str]) -> str:
"""TTS via Supertonic. Returnează __AUDIO__:/cale sau text de eroare.
@@ -732,7 +744,7 @@ def cmd_audio(args: list[str]) -> str:
remaining = list(args)
# Detectare voce ca prim token
if remaining and remaining[0].upper() in _VOICES:
if remaining and remaining[0].upper() in _supertonic_voice_names():
voice = remaining[0].upper()
remaining = remaining[1:]