Fix: TTS-Sonderzeichen (& → und, % → Prozent, °/=/Schrägstrich) + **fett** im Chat gerendert

Stimme las '&' u.a. wörtlich/komisch vor → cleanForTTS wandelt Sonderzeichen aussprechbar um.
Anzeige rendert **fett** jetzt als echte Fettschrift statt roher Sternchen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-28 10:16:33 +02:00
parent 799a0c72e9
commit 9332971384
5 changed files with 21 additions and 7 deletions
+6
View File
@@ -33,6 +33,12 @@ function cleanForTTS(s: string): string {
.replace(/\b\S+@\S+\.\S+\b/g, " ") // E-Mails
.replace(/[*_#>~|`]+/g, " ") // Markdown-Zeichen
.replace(/^\s*[-•·]\s+/gm, " ") // Listen-Bullets
// Sonderzeichen aussprechbar machen (sonst liest die Stimme sie wörtlich/komisch):
.replace(/\s*&\s*/g, " und ")
.replace(/(\d)\s*%/g, "$1 Prozent").replace(/%/g, " Prozent ")
.replace(/(\d)\s*°\s*C?/g, "$1 Grad").replace(/°/g, " Grad ")
.replace(/\s*=\s*/g, " gleich ")
.replace(/\s*\/\s*/g, " ") // Schrägstriche → Pause statt „Schrägstrich"
.replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu, "") // Emojis/Symbole
.replace(/\s+/g, " ")
.trim()