mirror of
https://github.com/open-webui/open-webui
synced 2025-02-06 13:10:16 +00:00
feat: markdown image preview
This commit is contained in:
parent
ace3552e15
commit
88086935af
@ -55,7 +55,6 @@
|
|||||||
export let copyToClipboard: Function;
|
export let copyToClipboard: Function;
|
||||||
export let continueGeneration: Function;
|
export let continueGeneration: Function;
|
||||||
export let regenerateResponse: Function;
|
export let regenerateResponse: Function;
|
||||||
export let chatActionHandler: Function;
|
|
||||||
|
|
||||||
let model = null;
|
let model = null;
|
||||||
$: model = $models.find((m) => m.id === message.model);
|
$: model = $models.find((m) => m.id === message.model);
|
||||||
@ -528,6 +527,28 @@
|
|||||||
code={revertSanitizedResponseContent(token?.text ?? '')}
|
code={revertSanitizedResponseContent(token?.text ?? '')}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/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}
|
{:else}
|
||||||
{@html marked.parse(token.raw, {
|
{@html marked.parse(token.raw, {
|
||||||
...defaults,
|
...defaults,
|
||||||
|
@ -13,11 +13,13 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
|
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
|
||||||
<button
|
|
||||||
on:click={() => {
|
<div class="w-full">
|
||||||
console.log('image preview');
|
<button
|
||||||
showImagePreview = true;
|
on:click={() => {
|
||||||
}}
|
showImagePreview = true;
|
||||||
>
|
}}
|
||||||
<img src={_src} {alt} class=" max-h-96 rounded-lg" draggable="false" data-cy="image" />
|
>
|
||||||
</button>
|
<img src={_src} {alt} class=" max-h-96 rounded-lg" draggable="false" data-cy="image" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user