mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
enh: summary tag support
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<script>
|
||||
import { marked } from 'marked';
|
||||
import markedKatex from '$lib/utils/marked/katex-extension';
|
||||
import { replaceTokens, processResponseContent } from '$lib/utils';
|
||||
import { user } from '$lib/stores';
|
||||
|
||||
import markedExtension from '$lib/utils/marked/extension';
|
||||
import markedKatexExtension from '$lib/utils/marked/katex-extension';
|
||||
|
||||
import MarkdownTokens from './Markdown/MarkdownTokens.svelte';
|
||||
|
||||
export let id;
|
||||
@@ -16,7 +18,8 @@
|
||||
throwOnError: false
|
||||
};
|
||||
|
||||
marked.use(markedKatex(options));
|
||||
marked.use(markedKatexExtension(options));
|
||||
marked.use(markedExtension(options));
|
||||
|
||||
$: (async () => {
|
||||
if (content) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import MarkdownInlineTokens from '$lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte';
|
||||
import KatexRenderer from './KatexRenderer.svelte';
|
||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { stringify } from 'postcss';
|
||||
|
||||
export let id: string;
|
||||
export let tokens: Token[];
|
||||
@@ -94,6 +95,12 @@
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{:else if token.type === 'details'}
|
||||
<details>
|
||||
<summary>{token.summary}</summary>
|
||||
|
||||
<svelte:self id={`${id}-${tokenIdx}-d`} tokens={marked.lexer(token.text)} />
|
||||
</details>
|
||||
{:else if token.type === 'html'}
|
||||
{@const html = DOMPurify.sanitize(token.text)}
|
||||
{#if html && html.includes('<video')}
|
||||
|
||||
Reference in New Issue
Block a user