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
+9 -1
View File
@@ -8,6 +8,14 @@ import { cn } from "@/lib/utils"
// Fester Avatar (das eine, gewählte VRM). Liegt unter frontend/public/avatar.vrm → /avatar.vrm.
const FIXED_AVATAR = "/avatar.vrm"
// **fett** als echte Fettschrift rendern (Rest als Text; Zeilenumbrüche via whitespace-pre-wrap).
function renderRich(text: string) {
return text.split(/(\*\*[^*\n]+\*\*)/g).map((p, i) => {
const m = p.match(/^\*\*([^*]+)\*\*$/)
return m ? <strong key={i} className="font-semibold text-foreground">{m[1]}</strong> : <span key={i}>{p}</span>
})
}
// Kleiner Tipp-Indikator („Hermes schreibt …").
function Dots() {
return (
@@ -134,7 +142,7 @@ export function VoiceView() {
? "rounded-br-sm bg-primary/15 text-foreground"
: "rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90",
)}>
{m.text || <Dots />}
{m.text ? renderRich(m.text) : <Dots />}
</div>
</div>
))}