refac
This commit is contained in:
@@ -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' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user