mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 08:40:58 +00:00
refac
This commit is contained in:
parent
7f394f3f00
commit
b02f6db475
@ -1,30 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Image from '$lib/components/common/Image.svelte';
|
||||
import CodeBlock from './CodeBlock.svelte';
|
||||
|
||||
/* The html content of the tag */
|
||||
export let html; //: string;
|
||||
let parsedHTML = [html];
|
||||
|
||||
export let images;
|
||||
export let codes;
|
||||
|
||||
// all images are in {{IMAGE_0}}, {{IMAGE_1}}.... format
|
||||
// all codes are in {{CODE_0}}, {{CODE_1}}.... format
|
||||
|
||||
const rules = [];
|
||||
rules.forEach((rule) => {
|
||||
parsedHTML = parsedHTML.map((substr) => substr.split(rule.regex)).flat();
|
||||
});
|
||||
</script>
|
||||
|
||||
{#each parsedHTML as part}
|
||||
{@const match = rules.find((rule) => rule.regex.test(part))}
|
||||
{#if match}
|
||||
<svelte:component this={match.component} {...match.props}>
|
||||
{@html part}
|
||||
</svelte:component>
|
||||
{:else}
|
||||
{@html part}
|
||||
{/if}
|
||||
{/each}
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user