From 73a7ccddcaaf00927bb369a5f3c63fa5c5a6e043 Mon Sep 17 00:00:00 2001 From: ah-admin Date: Sun, 4 Oct 2026 21:38:23 +0200 Subject: [PATCH] v1.38: Markdown in Assistenten-Antworten rendern (**fett**, *kursiv*, code) Sichtung live im Browser: Widget-Lasche/Panel/Chat geprueft, Chat beantwortet Frage korrekt; Kimi liefert Markdown, das zuvor als roher Text mit ** sichtbar war. Mini-Renderer in AssistChat (nur Text-Auszeichnungen, kein HTML). --- src/components/assist/AssistChat.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/components/assist/AssistChat.tsx b/src/components/assist/AssistChat.tsx index 4c6a829..71729b5 100644 --- a/src/components/assist/AssistChat.tsx +++ b/src/components/assist/AssistChat.tsx @@ -8,6 +8,28 @@ export interface Nachricht { text: string } +/** Mini-Markdown für Antwort-Bubbles: **fett**, *kursiv*, `code` – sicher gerendert (kein HTML). */ +function formatierterText(text: string) { + const teile = text.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g) + return teile.map((teil, i) => { + if (teil.startsWith('**') && teil.endsWith('**') && teil.length > 4) + return ( + + {teil.slice(2, -2)} + + ) + if (teil.startsWith('*') && teil.endsWith('*') && teil.length > 2) + return {teil.slice(1, -1)} + if (teil.startsWith('`') && teil.endsWith('`') && teil.length > 2) + return ( + + {teil.slice(1, -1)} + + ) + return {teil} + }) +} + const BEISPIELE = [ 'Welche Wohnungen stehen leer?', 'Wie hoch ist das monatliche Miet-Soll?', @@ -100,7 +122,7 @@ export default function AssistChat() { : 'bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-100' }`} > - {m.text} + {formatierterText(m.text)} {m.rolle === 'user' && (