From 434241149bf37332db551a9544056522f28f82c1 Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Sun, 15 Dec 2024 19:13:29 -0500 Subject: [PATCH] feat: Add comprehensive logging for Google Drive file upload process --- src/lib/components/chat/Chat.svelte | 17 ++++++++++++++++- src/lib/components/chat/MessageInput.svelte | 20 +++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 40ad1588c..9d483edc1 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -350,7 +350,14 @@ // File upload functions const uploadGoogleDriveFile = async (fileData) => { - console.log('Uploading Google Drive file:', fileData); + console.log('Starting uploadGoogleDriveFile with:', { + id: fileData.id, + name: fileData.name, + url: fileData.url, + headers: { + Authorization: 'Bearer [REDACTED]' + } + }); const tempItemId = uuidv4(); const fileItem = { type: 'file', @@ -374,12 +381,20 @@ 'Accept': 'application/json' }; + console.log('Calling processWeb with:', { + url: fileData.url, + headers: { + Authorization: 'Bearer [REDACTED]', + Accept: 'application/json' + } + }); const res = await processWeb( localStorage.token, '', fileData.url, headers ); + console.log('processWeb response:', res); if (res && res.collection_name) { console.log('File processed successfully:', res); diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index d1364a75f..ddc266136 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -526,13 +526,23 @@ const fileData = await createPicker(); console.log('Picker returned file data:', fileData); if (fileData) { - console.log('Dispatching upload event with file data'); - dispatch('upload', { - type: 'google-drive', - data: fileData // fileData now includes token + console.log('Preparing to dispatch upload event with:', { + id: fileData.id, + name: fileData.name, + url: fileData.url, + headers: { + Authorization: 'Bearer [REDACTED]' + } }); + const uploadEvent = { + type: 'google-drive', + data: fileData + }; + console.log('Dispatching upload event:', uploadEvent); + dispatch('upload', uploadEvent); + console.log('Upload event dispatched'); } else { - console.log('No file was selected'); + console.log('No file was selected from Google Drive'); } } catch (error) { console.error('Google Drive Error:', error);