diff --git a/src/public/app/widgets/llm_chat_panel.ts b/src/public/app/widgets/llm_chat_panel.ts index 4aac66096..21133039c 100644 --- a/src/public/app/widgets/llm_chat_panel.ts +++ b/src/public/app/widgets/llm_chat_panel.ts @@ -7,6 +7,7 @@ import { t } from "../services/i18n.js"; import libraryLoader from "../services/library_loader.js"; import { applySyntaxHighlight } from "../services/syntax_highlight.js"; import options from "../services/options.js"; +import { marked } from "marked"; // Import the LLM Chat CSS (async function() { @@ -429,13 +430,6 @@ export default class LlmChatPanel extends BasicWidget { private formatMarkdown(content: string): string { if (!content) return ''; - // Check if content contains HTML sections for thinking visualization - if (content.includes('
${code}
`);
- return placeholder;
+ // Use marked library to parse the markdown
+ const markedContent = marked(processedContent, {
+ breaks: true, // Convert line breaks to $1
')
- .replace(/\n/g, '