mirror of
				https://github.com/open-webui/open-webui
				synced 2025-06-26 18:26:48 +00:00 
			
		
		
		
	Fix Google Drive integration
This commit is contained in:
		
							parent
							
								
									1c7ff7b1dc
								
							
						
					
					
						commit
						909c94e983
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -307,3 +307,4 @@ dist
 | 
			
		||||
cypress/videos
 | 
			
		||||
cypress/screenshots
 | 
			
		||||
.vscode/settings.json
 | 
			
		||||
.aider*
 | 
			
		||||
 | 
			
		||||
@ -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(
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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 @@
 | 
			
		||||
			<div class="flex justify-between items-center text-xs">
 | 
			
		||||
				<div class="text-xs font-medium">{$i18n.t('Enable Google Drive')}</div>
 | 
			
		||||
				<div>
 | 
			
		||||
					<Switch bind:state={enableGoogleDriveIntegration} on:change={() => {
 | 
			
		||||
					    console.log('Google Drive Integration before change:', enableGoogleDriveIntegration);
 | 
			
		||||
					    enableGoogleDriveIntegration = !enableGoogleDriveIntegration;
 | 
			
		||||
					    console.log('Google Drive Integration after change:', enableGoogleDriveIntegration);
 | 
			
		||||
					}} />
 | 
			
		||||
					<Switch bind:state={enableGoogleDriveIntegration} />
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user