fix: fixess issue #7181

This commit is contained in:
Juanan Pereira
2025-01-13 18:21:00 +01:00
parent b6128efb43
commit f477f4f790
5 changed files with 34 additions and 15 deletions

View File

@@ -38,6 +38,7 @@
import { generateAutoCompletion } from '$lib/apis';
import { error, text } from '@sveltejs/kit';
import Image from '../common/Image.svelte';
import { deleteFileById } from '$lib/apis/files';
const i18n = getContext('i18n');
@@ -615,9 +616,19 @@
loading={file.status === 'uploading'}
dismissible={true}
edit={true}
on:dismiss={() => {
files.splice(fileIdx, 1);
files = files;
on:dismiss={async () => {
try {
if (file.id) {
// This will handle both file deletion and Chroma cleanup
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);
}
}}
on:click={() => {
console.log(file);