From 63bf4cad0f2e6ffcbabdd0cfaedcf8fec3ce8f40 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 8 Sep 2025 18:01:28 -0300 Subject: [PATCH 1/3] Refactor settings page to streamline state updates and remove unused interfaces This commit simplifies the state update logic in the KnowledgeSourcesPage component by replacing multiple conditional assignments with concise if statements. Additionally, it removes unused GoogleDriveFile and OneDriveFile interfaces, enhancing code clarity and maintainability in line with best practices for async development. --- frontend/src/app/settings/page.tsx | 31 +++++------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/settings/page.tsx b/frontend/src/app/settings/page.tsx index 1c979fd7..48482a35 100644 --- a/frontend/src/app/settings/page.tsx +++ b/frontend/src/app/settings/page.tsx @@ -19,24 +19,6 @@ import { ProtectedRoute } from "@/components/protected-route"; import { useTask } from "@/contexts/task-context"; import { useAuth } from "@/contexts/auth-context"; -interface GoogleDriveFile { - id: string - name: string - mimeType: string - webViewLink?: string - iconLink?: string -} - -interface OneDriveFile { - id: string - name: string - mimeType?: string - webUrl?: string - driveItem?: { - file?: { mimeType: string } - folder?: unknown - } -} interface Connector { id: string; @@ -105,14 +87,11 @@ function KnowledgeSourcesPage() { if (response.ok) { const settings = await response.json(); // Update all state cleanly - settings.flow_id && setFlowId(settings.flow_id); - settings.ingest_flow_id && setIngestFlowId(settings.ingest_flow_id); - settings.langflow_edit_url && - setLangflowEditUrl(settings.langflow_edit_url); - settings.langflow_ingest_edit_url && - setLangflowIngestEditUrl(settings.langflow_ingest_edit_url); - settings.langflow_public_url && - setPublicLangflowUrl(settings.langflow_public_url); + if (settings.flow_id) setFlowId(settings.flow_id); + if (settings.ingest_flow_id) setIngestFlowId(settings.ingest_flow_id); + if (settings.langflow_edit_url) setLangflowEditUrl(settings.langflow_edit_url); + if (settings.langflow_ingest_edit_url) setLangflowIngestEditUrl(settings.langflow_ingest_edit_url); + if (settings.langflow_public_url) setPublicLangflowUrl(settings.langflow_public_url); if (settings.ingestion_defaults) { console.log( "Loading ingestion defaults from backend:", From 69c064763af60c45618a47a79b19c6de64173373 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 8 Sep 2025 18:01:39 -0300 Subject: [PATCH 2/3] Add environment and build file exclusions to .dockerignore This commit expands the .dockerignore file to include various environment files, authentication files, dependency directories, Python cache files, build outputs, development files, logs, OS-specific files, and temporary files. These additions enhance the Docker build process by preventing unnecessary files from being included, thereby improving efficiency and maintainability in line with best practices for async development. --- .dockerignore | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/.dockerignore b/.dockerignore index 8e0ed179..3f0066a9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,49 @@ +# Environment files .env +.env.local +.env.development +.env.production + +# Auth files .drive.json +*.json + +# Dependencies +node_modules/ +*/node_modules/ +**/node_modules/ + +# Python cache +__pycache__/ +*/__pycache__/ +**/__pycache__/ +*.pyc +*.pyo +*.pyd +.Python + +# Build outputs +build/ +dist/ +.next/ +out/ + +# Development files +.git/ +.gitignore +README.md +*.md +.vscode/ +.idea/ + +# Logs +*.log +logs/ + +# OS files +.DS_Store +Thumbs.db + +# Temporary files +tmp/ +temp/ From 762152934e3a0953eee9b6ae1de1fec3d25ce466 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 8 Sep 2025 18:05:55 -0300 Subject: [PATCH 3/3] Add async method to retrieve connector by ID in LangflowConnectorService This commit introduces the _get_connector method in the LangflowConnectorService class, providing an asynchronous way to retrieve a connector by its connection ID. This addition enhances the service's functionality and aligns with the ongoing improvements in asynchronous processing and code maintainability. --- src/connectors/langflow_connector_service.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connectors/langflow_connector_service.py b/src/connectors/langflow_connector_service.py index fa82eee7..52f0a6b8 100644 --- a/src/connectors/langflow_connector_service.py +++ b/src/connectors/langflow_connector_service.py @@ -288,3 +288,7 @@ class LangflowConnectorService: ) return task_id + + async def _get_connector(self, connection_id: str) -> Optional[BaseConnector]: + """Get a connector by connection ID (alias for get_connector)""" + return await self.get_connector(connection_id)