fix: XTTS bridge splits text into sentences sequentially
- XTTS-Bridge does sentence splitting (not ARIA-Bridge) - Sequential rendering: correct order guaranteed - Each sentence sent as separate xtts_response - Markdown removal before splitting - App starts playback after first sentence (faster UX) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-19
@@ -851,27 +851,20 @@ class ARIABridge:
|
||||
tts_engine = getattr(self, 'tts_engine_type', 'piper')
|
||||
|
||||
if tts_engine == "xtts":
|
||||
# XTTS: Lange Texte satzweise aufteilen (WebSocket-Limit + schnellere Wiedergabe)
|
||||
import re as _re
|
||||
# XTTS: Ganzen Text senden, XTTS-Bridge teilt satzweise auf
|
||||
xtts_voice = getattr(self, 'xtts_voice', '')
|
||||
clean_text = _re.sub(r'\*\*([^*]+)\*\*', r'\1', text).strip()
|
||||
sentences = _re.split(r'(?<=[.!?])\s+', clean_text)
|
||||
sentences = [s.strip() for s in sentences if s.strip()]
|
||||
if not sentences:
|
||||
sentences = [clean_text]
|
||||
try:
|
||||
for sentence in sentences:
|
||||
await self._send_to_rvs({
|
||||
"type": "xtts_request",
|
||||
"payload": {
|
||||
"text": sentence,
|
||||
"voice": xtts_voice,
|
||||
"language": "de",
|
||||
"requestId": str(uuid.uuid4()),
|
||||
},
|
||||
"timestamp": int(asyncio.get_event_loop().time() * 1000),
|
||||
})
|
||||
logger.info("[core] XTTS-Request gesendet (%s, %d Saetze): '%s'", xtts_voice or "default", len(sentences), text[:60])
|
||||
await self._send_to_rvs({
|
||||
"type": "xtts_request",
|
||||
"payload": {
|
||||
"text": text,
|
||||
"voice": xtts_voice,
|
||||
"language": "de",
|
||||
"requestId": str(uuid.uuid4()),
|
||||
},
|
||||
"timestamp": int(asyncio.get_event_loop().time() * 1000),
|
||||
})
|
||||
logger.info("[core] XTTS-Request gesendet (%s): '%s'", xtts_voice or "default", text[:60])
|
||||
except Exception as e:
|
||||
logger.warning("[core] XTTS-Request fehlgeschlagen: %s — Fallback auf Piper", e)
|
||||
# Fallback auf Piper
|
||||
|
||||
Reference in New Issue
Block a user