From 0f287c8a096d6dc0076bd4229634b3a0673f3f4e Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 5 Oct 2024 20:48:55 -0700 Subject: [PATCH] enh: floating codeblock buttons --- .../components/chat/Messages/CodeBlock.svelte | 159 +++++++++--------- .../chat/Messages/ResponseMessage.svelte | 2 +- 2 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 6432dd702..2ff625e55 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -288,88 +288,89 @@ __builtins__.input = input`); }); -
- {#if lang === 'mermaid'} - {#if mermaidHtml} - {@html `${mermaidHtml}`} +
+
+ {#if lang === 'mermaid'} + {#if mermaidHtml} + {@html `${mermaidHtml}`} + {:else} +
{code}
+ {/if} {:else} -
{code}
- {/if} - {:else} -
-
{lang}
- -
- {#if lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code))} - {#if executing} -
Running
- {:else} - - {/if} - {/if} - - {#if save} - - {/if} - - -
-
- -
- {lang} - on:save={() => { - saveCode(); - }} - on:change={(e) => { - _code = e.detail.value; - }} +
+ +
+
+ {#if lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code))} + {#if executing} +
Running
+ {:else} + + {/if} + {/if} + + {#if save} + + {/if} + + +
+
+ +
+
+ { + saveCode(); + }} + on:change={(e) => { + _code = e.detail.value; + }} + /> +
+ +
-
- - -
- - {#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} - {/if} +
diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 21e2b200d..7d5e496d3 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -342,7 +342,7 @@ ($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)} /> -
+
{model?.name ?? message.model}