From 6f3e7ed0e9ee3d4fec521cf1646f28cc77e8460f Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Thu, 26 Dec 2024 12:19:53 -0500 Subject: [PATCH 1/9] debug: Add console logs for Google Drive Integration state changes --- src/lib/components/admin/Settings/Documents.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index f14401d99..2fabe5a96 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -250,6 +250,7 @@ fileMaxCount = res?.file.max_count ?? ''; enableGoogleDriveIntegration = res.enable_google_drive_integration; + console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); } }); @@ -597,7 +598,7 @@
{$i18n.t('Enable Google Drive')}
- + console.log('Google Drive Integration:', enableGoogleDriveIntegration)} />
From c7cec2131cef2982cce354d7a80eee6bdbb71994 Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Thu, 26 Dec 2024 12:21:38 -0500 Subject: [PATCH 2/9] debug: Add detailed logging for Google Drive Integration state changes --- src/lib/components/admin/Settings/Documents.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 2fabe5a96..c5424389a 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -251,6 +251,11 @@ enableGoogleDriveIntegration = res.enable_google_drive_integration; console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); + if (enableGoogleDriveIntegration === undefined) { + console.error('enableGoogleDriveIntegration is undefined onMount'); + } else { + console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); + } } }); @@ -598,7 +603,11 @@
{$i18n.t('Enable Google Drive')}
- console.log('Google Drive Integration:', enableGoogleDriveIntegration)} /> + { + console.log('Google Drive Integration before change:', enableGoogleDriveIntegration); + enableGoogleDriveIntegration = !enableGoogleDriveIntegration; + console.log('Google Drive Integration after change:', enableGoogleDriveIntegration); + }} />
From 1c7ff7b1dccdc48a191373fc3490aa2ef0b18b95 Mon Sep 17 00:00:00 2001 From: "Taylor Wilsdon (aider)" Date: Thu, 26 Dec 2024 12:22:58 -0500 Subject: [PATCH 3/9] fix: Initialize enableGoogleDriveIntegration with default value --- src/lib/components/admin/Settings/Documents.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index c5424389a..b245c823d 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -249,7 +249,7 @@ fileMaxSize = res?.file.max_size ?? ''; fileMaxCount = res?.file.max_count ?? ''; - enableGoogleDriveIntegration = res.enable_google_drive_integration; + enableGoogleDriveIntegration = res.enable_google_drive_integration ?? false; console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); if (enableGoogleDriveIntegration === undefined) { console.error('enableGoogleDriveIntegration is undefined onMount'); From 909c94e983ff364431a8bd631e7b662cf100e8ac Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:41:58 -0500 Subject: [PATCH 4/9] Fix Google Drive integration --- .gitignore | 1 + backend/open_webui/config.py | 22 +++++++++---------- backend/open_webui/routers/retrieval.py | 2 +- .../admin/Settings/Documents.svelte | 12 ++++------ 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 32271f808..a3cea4514 100644 --- a/.gitignore +++ b/.gitignore @@ -307,3 +307,4 @@ dist cypress/videos cypress/screenshots .vscode/settings.json +.aider* diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index e6e66f34a..f6ee4a843 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -307,17 +307,6 @@ GOOGLE_CLIENT_SECRET = PersistentConfig( os.environ.get("GOOGLE_CLIENT_SECRET", ""), ) -GOOGLE_DRIVE_CLIENT_ID = PersistentConfig( - "GOOGLE_DRIVE_CLIENT_ID", - "google_drive.client_id", - os.environ.get("GOOGLE_DRIVE_CLIENT_ID", ""), -) - -GOOGLE_DRIVE_API_KEY = PersistentConfig( - "GOOGLE_DRIVE_API_KEY", - "google_drive.api_key", - os.environ.get("GOOGLE_DRIVE_API_KEY", ""), -) GOOGLE_OAUTH_SCOPE = PersistentConfig( "GOOGLE_OAUTH_SCOPE", @@ -1223,6 +1212,17 @@ ENABLE_GOOGLE_DRIVE_INTEGRATION = PersistentConfig( os.getenv("ENABLE_GOOGLE_DRIVE_INTEGRATION", "False").lower() == "true", ) +GOOGLE_DRIVE_CLIENT_ID = PersistentConfig( + "GOOGLE_DRIVE_CLIENT_ID", + "google_drive.client_id", + os.environ.get("GOOGLE_DRIVE_CLIENT_ID", ""), +) + +GOOGLE_DRIVE_API_KEY = PersistentConfig( + "GOOGLE_DRIVE_API_KEY", + "google_drive.api_key", + os.environ.get("GOOGLE_DRIVE_API_KEY", ""), +) # RAG Content Extraction CONTENT_EXTRACTION_ENGINE = PersistentConfig( diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index 4444581f5..d6ff463a9 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -347,7 +347,7 @@ async def get_rag_config(request: Request, user=Depends(get_admin_user)): return { "status": True, "pdf_extract_images": request.app.state.config.PDF_EXTRACT_IMAGES, - "ENABLE_GOOGLE_DRIVE_INTEGRATION": request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION, + "enable_google_drive_integration": request.app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION, "content_extraction": { "engine": request.app.state.config.CONTENT_EXTRACTION_ENGINE, "tika_server_url": request.app.state.config.TIKA_SERVER_URL, diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index b245c823d..055c3c0fe 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -192,6 +192,7 @@ tika_server_url: tikaServerUrl } }); + console.log(res) await updateQuerySettings(localStorage.token, querySettings); @@ -234,7 +235,7 @@ querySettings = await getQuerySettings(localStorage.token); const res = await getRAGConfig(localStorage.token); - + console.log(res) if (res) { pdfExtractImages = res.pdf_extract_images; @@ -248,8 +249,7 @@ fileMaxSize = res?.file.max_size ?? ''; fileMaxCount = res?.file.max_count ?? ''; - - enableGoogleDriveIntegration = res.enable_google_drive_integration ?? false; + enableGoogleDriveIntegration = res.enable_google_drive_integration; console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); if (enableGoogleDriveIntegration === undefined) { console.error('enableGoogleDriveIntegration is undefined onMount'); @@ -603,11 +603,7 @@
{$i18n.t('Enable Google Drive')}
- { - console.log('Google Drive Integration before change:', enableGoogleDriveIntegration); - enableGoogleDriveIntegration = !enableGoogleDriveIntegration; - console.log('Google Drive Integration after change:', enableGoogleDriveIntegration); - }} /> +
From ea115219610d5ff0c6a9a8e1c0d5bee1ff5bfe0b Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:44:36 -0500 Subject: [PATCH 5/9] Remove unnecessary logging --- src/lib/components/admin/Settings/Documents.svelte | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 055c3c0fe..517751bcb 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -250,12 +250,6 @@ fileMaxSize = res?.file.max_size ?? ''; fileMaxCount = res?.file.max_count ?? ''; enableGoogleDriveIntegration = res.enable_google_drive_integration; - console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); - if (enableGoogleDriveIntegration === undefined) { - console.error('enableGoogleDriveIntegration is undefined onMount'); - } else { - console.log('Google Drive Integration onMount:', enableGoogleDriveIntegration); - } } }); From 190911206b68f4f8bb76ed28a93d8395508a89c0 Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:46:06 -0500 Subject: [PATCH 6/9] Remove logging --- src/lib/components/admin/Settings/Documents.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 517751bcb..da106d9f7 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -192,7 +192,6 @@ tika_server_url: tikaServerUrl } }); - console.log(res) await updateQuerySettings(localStorage.token, querySettings); @@ -235,7 +234,6 @@ querySettings = await getQuerySettings(localStorage.token); const res = await getRAGConfig(localStorage.token); - console.log(res) if (res) { pdfExtractImages = res.pdf_extract_images; From 24a314876bd7dd7ebbb0a42457a71cb3f1f43f5a Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:46:41 -0500 Subject: [PATCH 7/9] formatting --- src/lib/components/admin/Settings/Documents.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index da106d9f7..4976ec8b3 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -234,6 +234,7 @@ querySettings = await getQuerySettings(localStorage.token); const res = await getRAGConfig(localStorage.token); + if (res) { pdfExtractImages = res.pdf_extract_images; @@ -247,6 +248,7 @@ fileMaxSize = res?.file.max_size ?? ''; fileMaxCount = res?.file.max_count ?? ''; + enableGoogleDriveIntegration = res.enable_google_drive_integration; } }); From 3cfb6507c5f0b8cc0107c4936d84d0f06af79c97 Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:47:41 -0500 Subject: [PATCH 8/9] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a3cea4514..32271f808 100644 --- a/.gitignore +++ b/.gitignore @@ -307,4 +307,3 @@ dist cypress/videos cypress/screenshots .vscode/settings.json -.aider* From efc4ad9f655c1c3e2d21ba476ca8440cce078274 Mon Sep 17 00:00:00 2001 From: Taylor Wilsdon Date: Thu, 26 Dec 2024 14:48:38 -0500 Subject: [PATCH 9/9] Update Documents.svelte --- src/lib/components/admin/Settings/Documents.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 4976ec8b3..f14401d99 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -248,7 +248,7 @@ fileMaxSize = res?.file.max_size ?? ''; fileMaxCount = res?.file.max_count ?? ''; - + enableGoogleDriveIntegration = res.enable_google_drive_integration; } });