diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 9bf3a0813..4664940d3 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -1187,6 +1187,7 @@ import { getContext } from 'svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte'; + import Image from '$lib/components/common/Image.svelte'; import GarbageBin from '$lib/components/icons/GarbageBin.svelte'; import EditPencil from '$lib/components/icons/EditPencil.svelte'; import ArrowForward from '$lib/components/icons/ArrowForward.svelte'; + import { WEBUI_API_BASE_URL } from '$lib/constants'; const i18n = getContext('i18n'); export let id: string; export let content: string; + export let files: any[] = []; export let onSendNow: (id: string) => void; export let onEdit: (id: string) => void; export let onDelete: (id: string) => void; @@ -21,8 +24,34 @@ -
-

{content}

+
+ {#if files.length > 0} +
+ {#each files as file} + {#if file.type === 'image' || (file?.content_type ?? '').startsWith('image/')} + {@const fileUrl = + file.url?.startsWith('data') || file.url?.startsWith('http') + ? file.url + : `${WEBUI_API_BASE_URL}/files/${file.url}${file?.content_type ? '/content' : ''}`} + + {:else} +
+ {file.name ?? 'file'} +
+ {/if} + {/each} +
+ {/if} + + {#if content} +

{content}

+ {:else if files.length === 0} +

{$i18n.t('Empty message')}

+ {/if}