chore: auto-commit from dashboard

This commit is contained in:
2026-07-12 19:28:42 +00:00
parent 80eb8034b3
commit 4d2dbfb8a7
22 changed files with 582 additions and 520 deletions

View File

@@ -33,6 +33,7 @@ from typing import Any, Callable, Optional
import numpy as np
from src.router import _strip_leading_voice_tokens
from src.voice._discord_voice_adapter import AudioSink, VoiceData
from src.voice.voice_commands import detect_voice_change
@@ -410,8 +411,11 @@ class VoiceSession:
def voice_stream_callback(block: str) -> None:
"""Called once per Claude streamed text block — pushes to TTS."""
block_count[0] += 1
# Modelul imită uneori prefixul de turn ([voice] [speaker:...]
# [tts-lang:...]) în răspuns — nu trebuie citit cu voce.
block = _strip_leading_voice_tokens(block or "")
log.info("voice stream block #%d (%d chars): %r",
block_count[0], len(block or ""), (block or "")[:80])
block_count[0], len(block), block[:80])
try:
self.ttsq.push_text(block)
except Exception as e: # noqa: BLE001
@@ -431,7 +435,7 @@ class VoiceSession:
"discord-voice", # adapter_name
)
if isinstance(result, tuple) and result:
response_text = result[0] or ""
response_text = _strip_leading_voice_tokens(result[0] or "")
except Exception as e: # noqa: BLE001
log.error("route_message voice path failed: %s", e)

View File

@@ -22,7 +22,7 @@ from typing import Iterator, List, Optional
import discord
from src.voice.normalize import normalize_for_tts
from tools.tts import DEFAULT_VOICE, engine_for_voice, looks_romanian, synthesize
from tools.tts import engine_for_voice, fold_ro_diacritics, looks_romanian, synthesize
log = logging.getLogger(__name__)
@@ -210,18 +210,17 @@ class TTSQueue:
# pocket-tts refuses to speak (silent dropped clause).
voice = self.voice_id
english_only = engine_for_voice(voice) == "pockettts"
if english_only and looks_romanian(text):
# Claude a încălcat regula [tts-lang:en] — pocket-tts ar respinge
# fiecare clauză și turnul ar fi tăcere totală. Mai bine vocea
# Supertonic implicită în română decât nimic.
log.warning(
"pocket-tts voice %r got Romanian text — falling back to "
"Supertonic %r for this block", voice, DEFAULT_VOICE,
)
voice = DEFAULT_VOICE
english_only = False
lang = "en" if english_only else "ro"
cleaned = normalize_for_tts(text, lang=lang)
if english_only and looks_romanian(cleaned):
# Diacritice scăpate (nume proprii, cuvinte RO) NU schimbă vocea
# și NU reduc clauza la tăcere: se transliterează la ASCII ca
# pocket-tts să le accepte. Preferința lui Marius: continuitatea
# vocii clonate > pronunție exactă.
log.info(
"pocket-tts voice %r: folding RO diacritics in block", voice,
)
cleaned = fold_ro_diacritics(cleaned)
n = 0
for clause in clause_segments(cleaned):
clause = clause.strip()