From b02f6db4756c9d35173808e397845c777f236827 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 18 Aug 2024 18:28:58 +0200 Subject: [PATCH] refac --- .../chat/Messages/HTMLRenderer.svelte | 30 ------------------- .../{ => Markdown}/KatexRenderer.svelte | 0 .../MarkdownInlineTokens.svelte | 0 .../{ => Markdown}/MarkdownTokens.svelte | 2 +- .../chat/Messages/ResponseMessage.svelte | 2 +- .../chat/Messages/UserMessage.svelte | 2 +- 6 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 src/lib/components/chat/Messages/HTMLRenderer.svelte rename src/lib/components/chat/Messages/{ => Markdown}/KatexRenderer.svelte (100%) rename src/lib/components/chat/Messages/{ => Markdown}/MarkdownInlineTokens.svelte (100%) rename src/lib/components/chat/Messages/{ => Markdown}/MarkdownTokens.svelte (99%) diff --git a/src/lib/components/chat/Messages/HTMLRenderer.svelte b/src/lib/components/chat/Messages/HTMLRenderer.svelte deleted file mode 100644 index 53fad8084..000000000 --- a/src/lib/components/chat/Messages/HTMLRenderer.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - -{#each parsedHTML as part} - {@const match = rules.find((rule) => rule.regex.test(part))} - {#if match} - - {@html part} - - {:else} - {@html part} - {/if} -{/each} diff --git a/src/lib/components/chat/Messages/KatexRenderer.svelte b/src/lib/components/chat/Messages/Markdown/KatexRenderer.svelte similarity index 100% rename from src/lib/components/chat/Messages/KatexRenderer.svelte rename to src/lib/components/chat/Messages/Markdown/KatexRenderer.svelte diff --git a/src/lib/components/chat/Messages/MarkdownInlineTokens.svelte b/src/lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte similarity index 100% rename from src/lib/components/chat/Messages/MarkdownInlineTokens.svelte rename to src/lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte diff --git a/src/lib/components/chat/Messages/MarkdownTokens.svelte b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte similarity index 99% rename from src/lib/components/chat/Messages/MarkdownTokens.svelte rename to src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte index e51dcc2ee..32f9046b1 100644 --- a/src/lib/components/chat/Messages/MarkdownTokens.svelte +++ b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte @@ -5,7 +5,7 @@ import { revertSanitizedResponseContent, unescapeHtml } from '$lib/utils'; import CodeBlock from '$lib/components/chat/Messages/CodeBlock.svelte'; - import MarkdownInlineTokens from '$lib/components/chat/Messages/MarkdownInlineTokens.svelte'; + import MarkdownInlineTokens from '$lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte'; import KatexRenderer from './KatexRenderer.svelte'; import { WEBUI_BASE_URL } from '$lib/constants'; diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 79b51c8d2..fa166853a 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -33,7 +33,7 @@ import Spinner from '$lib/components/common/Spinner.svelte'; import WebSearchResults from './ResponseMessage/WebSearchResults.svelte'; import Sparkles from '$lib/components/icons/Sparkles.svelte'; - import MarkdownTokens from './MarkdownTokens.svelte'; + import MarkdownTokens from './Markdown/MarkdownTokens.svelte'; export let message; export let siblings; diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index b18c1bd8d..11d14523f 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -12,7 +12,7 @@ import FileItem from '$lib/components/common/FileItem.svelte'; import { marked } from 'marked'; import { processResponseContent, replaceTokens } from '$lib/utils'; - import MarkdownTokens from './MarkdownTokens.svelte'; + import MarkdownTokens from './Markdown/MarkdownTokens.svelte'; const i18n = getContext('i18n');