From dbd5b4c9f19c999d42e23cd239f3c1b1dc663ae6 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 15 Aug 2024 15:41:02 +0200 Subject: [PATCH] enh: render markdown user message --- .../chat/Messages/UserMessage.svelte | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index 1dea97f11..59f9af4c9 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -10,6 +10,9 @@ import { user as _user } from '$lib/stores'; import { getFileContentById } from '$lib/apis/files'; import FileItem from '$lib/components/common/FileItem.svelte'; + import { marked } from 'marked'; + import { processResponseContent, replaceTokens } from '$lib/utils'; + import MarkdownTokens from './MarkdownTokens.svelte'; const i18n = getContext('i18n'); @@ -91,7 +94,7 @@ {/if}
{#if message.files}
@@ -162,15 +165,24 @@
{:else}
-
+
-
{message.content}
+ {#if message.content} +
+ {#key message.id} + + {/key} +
+ {/if}