diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 1ef0c1a29..431fd30b6 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -356,12 +356,13 @@ collection_name: '', status: 'uploading', url: fileData.url, + headers: fileData.headers, error: '' }; try { files = [...files, fileItem]; - const res = await processWeb(localStorage.token, '', fileData.url); + const res = await processWeb(localStorage.token, '', fileData.url, fileData.headers); if (res) { fileItem.status = 'uploaded'; diff --git a/src/lib/utils/google-drive-picker.ts b/src/lib/utils/google-drive-picker.ts index bac4bf586..7418459e3 100644 --- a/src/lib/utils/google-drive-picker.ts +++ b/src/lib/utils/google-drive-picker.ts @@ -119,14 +119,15 @@ export const createPicker = () => { url: fileUrl }); - // Get the downloadUrl using the alt=media parameter - // Construct download URL with access token - const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&access_token=${oauthToken}`; + // Construct download URL without embedding token + const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media`; const result = { id: fileId, name: fileName, url: downloadUrl, - token: oauthToken // Include token for future use + headers: { + 'Authorization': `Bearer ${oauthToken}` + } }; console.log('Resolving picker with:', result); resolve(result);