refac
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
{@const html = DOMPurify.sanitize(token.text)}
|
||||
{#if html && html.includes('<video')}
|
||||
{@html html}
|
||||
{:else if token.text.includes(`<iframe src="${WEBUI_BASE_URL}/api/v1/files/`)}
|
||||
{@html `${token.text}`}
|
||||
{:else}
|
||||
{token.text}
|
||||
{/if}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import DOMPurify from 'dompurify';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Token } from 'marked';
|
||||
import { marked, type Token } from 'marked';
|
||||
import { revertSanitizedResponseContent, unescapeHtml } from '$lib/utils';
|
||||
|
||||
import CodeBlock from '$lib/components/chat/Messages/CodeBlock.svelte';
|
||||
@@ -96,6 +96,8 @@
|
||||
{@const html = DOMPurify.sanitize(token.text)}
|
||||
{#if html && html.includes('<video')}
|
||||
{@html html}
|
||||
{:else if token.text.includes(`<iframe src="${WEBUI_BASE_URL}/api/v1/files/`)}
|
||||
{@html `${token.text}`}
|
||||
{:else}
|
||||
{token.text}
|
||||
{/if}
|
||||
|
||||
@@ -75,16 +75,13 @@
|
||||
let tokens;
|
||||
|
||||
import 'katex/dist/katex.min.css';
|
||||
|
||||
import markedKatex from '$lib/utils/marked/katex-extension';
|
||||
import markedToken from '$lib/utils/marked/token-extension';
|
||||
|
||||
const options = {
|
||||
throwOnError: false
|
||||
};
|
||||
|
||||
marked.use(markedKatex(options));
|
||||
marked.use(markedToken({ WEBUI_BASE_URL }));
|
||||
|
||||
$: (async () => {
|
||||
if (message?.content) {
|
||||
|
||||
Reference in New Issue
Block a user