diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index ac5b03a2a..35d967b6b 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -241,6 +241,22 @@ __builtins__.input = input`); debounceTimeout = setTimeout(highlightCode, 10); } } + + onMount(async () => { + if (document.documentElement.classList.contains('dark')) { + mermaid.initialize({ + startOnLoad: true, + theme: 'dark', + securityLevel: 'loose' + }); + } else { + mermaid.initialize({ + startOnLoad: true, + theme: 'default', + securityLevel: 'loose' + }); + } + });