From 1597e33a74a8e3ec69030b72a1fac78214475978 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 14 Aug 2024 16:27:55 +0200 Subject: [PATCH] refac: mermaid chart rendering --- .../components/chat/Messages/CodeBlock.svelte | 92 ++++++++++--------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 5fa4299ea..33b0572f4 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -222,55 +222,59 @@ __builtins__.input = input`);
-
-
{@html lang}
+ {#if lang === 'mermaid'} +
{code}
+ {:else} +
+
{@html lang}
-
- {#if lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code))} - {#if executing} -
Running
- {:else} - +
+ {#if lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code))} + {#if executing} +
Running
+ {:else} + + {/if} {/if} - {/if} - + +
-
-
{#if highlightedCode}{@html highlightedCode}{:else}{code}{/if}
+
{#if highlightedCode}{@html highlightedCode}{:else}{code}{/if}
-
+
- {#if executing} -
-
STDOUT/STDERR
-
Running...
-
- {:else if stdout || stderr || result} -
-
STDOUT/STDERR
-
{stdout || stderr || result}
-
+ {#if executing} +
+
STDOUT/STDERR
+
Running...
+
+ {:else if stdout || stderr || result} +
+
STDOUT/STDERR
+
{stdout || stderr || result}
+
+ {/if} {/if}