From 1cc4eb241a4305a59cb1218fc4c48dd9cbf8d0c6 Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Mon, 16 Dec 2024 10:40:08 -0500 Subject: [PATCH] feat: Improve Google Drive file upload handling in chat context --- src/lib/components/chat/MessageInput.svelte | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 618df6470..c88d6cc0f 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -532,12 +532,16 @@ url: fileData.url, headers: fileData.headers // Use the actual headers from the picker }); - const uploadEvent = { - type: 'google-drive', - data: fileData - }; - console.log('Dispatching upload event:', uploadEvent); - dispatch('upload', uploadEvent); + // Create a File object from the blob with proper name + const file = new File([fileData.blob], fileData.name, { + type: fileData.blob.type + }); + console.log('Created File object:', { + name: file.name, + size: file.size, + type: file.type + }); + await uploadFileHandler(file); console.log('Upload event dispatched'); } else { console.log('No file was selected from Google Drive');