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:
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<title>Mission Control 2.0</title>
|
<title>Mission Control 2.0</title>
|
||||||
<script type="module" crossorigin src="/assets/index-Sr8SESP7.js"></script>
|
<script type="module" crossorigin src="/assets/index-By5Xg5Lz.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CH4ZNiiA.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-CH4ZNiiA.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ function cleanForTTS(s: string): string {
|
|||||||
.replace(/\b\S+@\S+\.\S+\b/g, " ") // E-Mails
|
.replace(/\b\S+@\S+\.\S+\b/g, " ") // E-Mails
|
||||||
.replace(/[*_#>~|`]+/g, " ") // Markdown-Zeichen
|
.replace(/[*_#>~|`]+/g, " ") // Markdown-Zeichen
|
||||||
.replace(/^\s*[-•·]\s+/gm, " ") // Listen-Bullets
|
.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(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu, "") // Emojis/Symbole
|
||||||
.replace(/\s+/g, " ")
|
.replace(/\s+/g, " ")
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ import { cn } from "@/lib/utils"
|
|||||||
// Fester Avatar (das eine, gewählte VRM). Liegt unter frontend/public/avatar.vrm → /avatar.vrm.
|
// Fester Avatar (das eine, gewählte VRM). Liegt unter frontend/public/avatar.vrm → /avatar.vrm.
|
||||||
const FIXED_AVATAR = "/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 …").
|
// Kleiner Tipp-Indikator („Hermes schreibt …").
|
||||||
function Dots() {
|
function Dots() {
|
||||||
return (
|
return (
|
||||||
@@ -134,7 +142,7 @@ export function VoiceView() {
|
|||||||
? "rounded-br-sm bg-primary/15 text-foreground"
|
? "rounded-br-sm bg-primary/15 text-foreground"
|
||||||
: "rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90",
|
: "rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90",
|
||||||
)}>
|
)}>
|
||||||
{m.text || <Dots />}
|
{m.text ? renderRich(m.text) : <Dots />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user