mirror of
https://github.com/open-webui/open-webui
synced 2025-02-01 15:24:25 +00:00
fix: file attachment
This commit is contained in:
parent
647195c578
commit
b5bce9cbea
@ -568,15 +568,15 @@
|
|||||||
dir={$settings?.chatDirection ?? 'LTR'}
|
dir={$settings?.chatDirection ?? 'LTR'}
|
||||||
>
|
>
|
||||||
{#if files.length > 0}
|
{#if files.length > 0}
|
||||||
<div class="mx-1 mt-2.5 mb-1 flex flex-wrap gap-2">
|
<div class="mx-1 mt-2.5 mb-1 flex items-center flex-wrap gap-2">
|
||||||
{#each files as file, fileIdx}
|
{#each files as file, fileIdx}
|
||||||
{#if file.type === 'image'}
|
{#if file.type === 'image'}
|
||||||
<div class=" relative group">
|
<div class=" relative group">
|
||||||
<div class="relative">
|
<div class="relative flex items-center">
|
||||||
<Image
|
<Image
|
||||||
src={file.url}
|
src={file.url}
|
||||||
alt="input"
|
alt="input"
|
||||||
imageClassName=" h-16 w-16 rounded-xl object-cover"
|
imageClassName=" size-14 rounded-xl object-cover"
|
||||||
/>
|
/>
|
||||||
{#if atSelectedModel ? visionCapableModels.length === 0 : selectedModels.length !== visionCapableModels.length}
|
{#if atSelectedModel ? visionCapableModels.length === 0 : selectedModels.length !== visionCapableModels.length}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@ -636,18 +636,16 @@
|
|||||||
dismissible={true}
|
dismissible={true}
|
||||||
edit={true}
|
edit={true}
|
||||||
on:dismiss={async () => {
|
on:dismiss={async () => {
|
||||||
try {
|
if (file.type !== 'collection' && !file?.collection) {
|
||||||
if (file.id) {
|
if (file.id) {
|
||||||
// This will handle both file deletion and Chroma cleanup
|
// This will handle both file deletion and Chroma cleanup
|
||||||
await deleteFileById(localStorage.token, file.id);
|
await deleteFileById(localStorage.token, file.id);
|
||||||
}
|
}
|
||||||
// Remove from UI state
|
|
||||||
files.splice(fileIdx, 1);
|
|
||||||
files = files;
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error deleting file:', e);
|
|
||||||
toast.error(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove from UI state
|
||||||
|
files.splice(fileIdx, 1);
|
||||||
|
files = files;
|
||||||
}}
|
}}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user