diff --git a/src/lib/components/chat/ChatControls.svelte b/src/lib/components/chat/ChatControls.svelte index 45c66f3e0..9cc44ce38 100644 --- a/src/lib/components/chat/ChatControls.svelte +++ b/src/lib/components/chat/ChatControls.svelte @@ -128,7 +128,6 @@ : 30 : 0} onResize={(size) => { - console.log(size); if (size === 0) { showControls.set(false); } else { diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index dbe49c232..15aea5e35 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -20,6 +20,8 @@ export let lang = ''; export let code = ''; + let _token = null; + let mermaidHtml = null; let highlightedCode = null; @@ -226,7 +228,7 @@ __builtins__.input = input`); } }; - $: if (token) { + const render = async () => { if (lang === 'mermaid' && (token?.raw ?? '').slice(-4).includes('```')) { (async () => { await drawMermaidDiagram(); @@ -242,6 +244,17 @@ __builtins__.input = input`); // Set a new timeout to debounce the code highlighting debounceTimeout = setTimeout(highlightCode, 10); } + }; + + $: if (token) { + if (JSON.stringify(token) !== JSON.stringify(_token)) { + console.log('hi'); + _token = token; + } + } + + $: if (_token) { + render(); } onMount(async () => {