mirror of
https://github.com/open-webui/open-webui
synced 2025-01-10 12:57:33 +00:00
26 lines
575 B
Svelte
26 lines
575 B
Svelte
<script lang="ts">
|
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
|
import ImagePreview from './ImagePreview.svelte';
|
|
|
|
export let src = '';
|
|
export let alt = '';
|
|
|
|
export let className = ' w-full';
|
|
|
|
let _src = '';
|
|
$: _src = src.startsWith('/') ? `${WEBUI_BASE_URL}${src}` : src;
|
|
|
|
let showImagePreview = false;
|
|
</script>
|
|
|
|
<button
|
|
class={className}
|
|
on:click={() => {
|
|
showImagePreview = true;
|
|
}}
|
|
>
|
|
<img src={_src} {alt} class=" rounded-lg cursor-pointer" draggable="false" data-cy="image" />
|
|
</button>
|
|
|
|
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
|