diff --git a/src/lib/components/chat/Messages/MarkdownTokens.svelte b/src/lib/components/chat/Messages/MarkdownTokens.svelte index 23a4ab06c..843d03a6f 100644 --- a/src/lib/components/chat/Messages/MarkdownTokens.svelte +++ b/src/lib/components/chat/Messages/MarkdownTokens.svelte @@ -39,6 +39,10 @@ const codeElement = document.getElementById(`code-${codeId}`); if (codeElement) { clearInterval(interval); + // If the code is already loaded, don't load it again + if (codeElement.innerHTML) { + return; + } new CodeBlock({ target: codeElement,