This commit is contained in:
Timothy Jaeryang Baek
2026-08-05 07:44:06 -05:00
parent 29eeda9f9a
commit 6c4d0ace16
4 changed files with 144 additions and 51 deletions
@@ -880,11 +880,17 @@
files = files;
} else {
fileItem.status = 'error';
fileItem.error = $i18n.t('Failed to upload file.');
files = files.filter((item) => item?.itemId !== tempItemId);
}
} catch (e) {
fileItem.status = 'error';
fileItem.error = `${e}`;
toast.error(`${e}`);
files = files.filter((item) => item?.itemId !== tempItemId);
} finally {
onUpload({ type: 'file' });
}
} else {
// If temporary chat is enabled, we just add the file to the list without uploading it.
@@ -897,8 +903,11 @@
});
if (content === null) {
fileItem.status = 'error';
fileItem.error = $i18n.t('Failed to extract content from the file.');
toast.error($i18n.t('Failed to extract content from the file.'));
files = files.filter((item) => item?.itemId !== tempItemId);
onUpload({ type: 'file' });
return null;
} else {
console.log('Extracted content from file:', {
@@ -913,6 +922,7 @@
fileItem.id = uuidv4(); // Temporary ID for the file
files = files;
onUpload({ type: 'file' });
}
}
};