mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: markdown image preview
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
export let copyToClipboard: Function;
|
||||
export let continueGeneration: Function;
|
||||
export let regenerateResponse: Function;
|
||||
export let chatActionHandler: Function;
|
||||
|
||||
let model = null;
|
||||
$: model = $models.find((m) => m.id === message.model);
|
||||
@@ -528,6 +527,28 @@
|
||||
code={revertSanitizedResponseContent(token?.text ?? '')}
|
||||
/>
|
||||
{/if}
|
||||
{:else if token.type === 'paragraph'}
|
||||
{#if token.tokens}
|
||||
{#each token.tokens as inlineToken}
|
||||
{#if inlineToken.type === 'image'}
|
||||
<Image src={inlineToken.href} alt={inlineToken.text} />
|
||||
{:else}
|
||||
{@html marked.parseInline(inlineToken.raw, {
|
||||
...defaults,
|
||||
gfm: true,
|
||||
breaks: true,
|
||||
renderer
|
||||
})}
|
||||
{/if}
|
||||
{/each}
|
||||
{:else}
|
||||
{@html marked.parseInline(token.raw, {
|
||||
...defaults,
|
||||
gfm: true,
|
||||
breaks: true,
|
||||
renderer
|
||||
})}
|
||||
{/if}
|
||||
{:else}
|
||||
{@html marked.parse(token.raw, {
|
||||
...defaults,
|
||||
|
||||
Reference in New Issue
Block a user