diff --git a/templates/index.html b/templates/index.html index 0421d95..63aac23 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,6 +11,7 @@ + @@ -190,7 +210,21 @@ function appendChat(user, msg, classes) { const win = document.getElementById('chat-window'); - win.innerHTML += `
${user}: ${msg}
`; + + // Fallback: Wenn `marked` nicht geladen ist, benutze den Rohtext + let formattedMsg = msg; + + // Wenn die Nachricht von der KI kommt, parse das Markdown in HTML! + if (user === "KI" && typeof marked !== 'undefined') { + formattedMsg = marked.parse(msg); + } + + win.innerHTML += ` +
+ ${user}: +
${formattedMsg}
+
+ `; win.scrollTop = win.scrollHeight; }