diff --git a/src/common/components/ButtonAttachFiles.tsx b/src/common/components/ButtonAttachFiles.tsx
index cca3d1f5f..0465124b7 100644
--- a/src/common/components/ButtonAttachFiles.tsx
+++ b/src/common/components/ButtonAttachFiles.tsx
@@ -7,26 +7,18 @@ import AttachFileRoundedIcon from '@mui/icons-material/AttachFileRounded';
import { KeyStroke } from '~/common/components/KeyStroke';
-const attachFileLegend =
-
- Attach files
- Drag & drop in chat for faster loads ⚡
-
- ;
-
-
export async function openFileForAttaching(
multiple: boolean,
- onAttachFiles: (files: FileWithHandle[]) => void,
-) {
+ onAttachFiles: (files: FileWithHandle[]) => void | Promise,
+): Promise {
try {
const selectedFiles = await fileOpen({ multiple });
if (selectedFiles) {
if (Array.isArray(selectedFiles)) {
if (selectedFiles.length)
- onAttachFiles(selectedFiles);
+ await onAttachFiles(selectedFiles);
} else {
- onAttachFiles([selectedFiles]);
+ await onAttachFiles([selectedFiles]);
}
}
} catch (error) {
@@ -35,6 +27,14 @@ export async function openFileForAttaching(
}
+const attachFileLegend =
+
+ Attach files
+ Drag & drop in chat for faster loads ⚡
+
+ ;
+
+
export const ButtonAttachFilesMemo = React.memo(ButtonAttachFiles);
function ButtonAttachFiles(props: { isMobile?: boolean, fullWidth?: boolean, multiple?: boolean, noToolTip?: boolean, onAttachFiles: (files: FileWithHandle[]) => void }) {