W n8n attention vm
This commit is contained in:
parent
9673612e92
commit
f6b36d9e95
@ -104,7 +104,7 @@ export function FileUpload({
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFileDrop = (e: React.DragEvent) => {
|
const handleFileDrop = async (e: React.DragEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
@ -115,11 +115,21 @@ export function FileUpload({
|
|||||||
setFile(droppedFile);
|
setFile(droppedFile);
|
||||||
// If this is a new mission, call onFileSelect instead of waiting for upload
|
// If this is a new mission, call onFileSelect instead of waiting for upload
|
||||||
if (isNewMission && onFileSelect) {
|
if (isNewMission && onFileSelect) {
|
||||||
onFileSelect({
|
try {
|
||||||
data: URL.createObjectURL(droppedFile),
|
const base64 = await convertFileToBase64(droppedFile);
|
||||||
name: droppedFile.name,
|
onFileSelect({
|
||||||
type: droppedFile.type
|
data: base64,
|
||||||
});
|
name: droppedFile.name,
|
||||||
|
type: droppedFile.type
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error converting file to base64:', error);
|
||||||
|
toast({
|
||||||
|
title: 'Error',
|
||||||
|
description: 'Failed to process file. Please try again.',
|
||||||
|
variant: 'destructive',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,11 +201,21 @@ export function FileUpload({
|
|||||||
// For new missions, just notify through the callback and don't try to upload
|
// For new missions, just notify through the callback and don't try to upload
|
||||||
if (isNewMission) {
|
if (isNewMission) {
|
||||||
if (onFileSelect) {
|
if (onFileSelect) {
|
||||||
onFileSelect({
|
try {
|
||||||
data: URL.createObjectURL(fileToUpload),
|
const base64 = await convertFileToBase64(fileToUpload);
|
||||||
name: fileToUpload.name,
|
onFileSelect({
|
||||||
type: fileToUpload.type
|
data: base64,
|
||||||
});
|
name: fileToUpload.name,
|
||||||
|
type: fileToUpload.type
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error converting file to base64:', error);
|
||||||
|
toast({
|
||||||
|
title: 'Error',
|
||||||
|
description: 'Failed to process file. Please try again.',
|
||||||
|
variant: 'destructive',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toast({
|
toast({
|
||||||
title: 'File selected',
|
title: 'File selected',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user