From 54828522f8a7f288453fcd5e19d461b922d7efa3 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:16:41 +0530 Subject: [PATCH] feat: add Dropbox integration support with configuration and connector updates --- docker/.env.example | 5 +++++ surfsense_backend/.env.example | 5 +++++ surfsense_backend/app/agents/new_chat/chat_deepagent.py | 7 +++++++ .../app/agents/new_chat/tools/knowledge_base.py | 3 +++ surfsense_backend/app/config/__init__.py | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/docker/.env.example b/docker/.env.example index 8297aae44..1b86f7e6c 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -209,6 +209,11 @@ STT_SERVICE=local/base # TEAMS_REDIRECT_URI=http://localhost:8000/api/v1/auth/teams/connector/callback # ONEDRIVE_REDIRECT_URI=http://localhost:8000/api/v1/auth/onedrive/connector/callback +# -- Dropbox -- +# DROPBOX_APP_KEY= +# DROPBOX_APP_SECRET= +# DROPBOX_REDIRECT_URI=http://localhost:8000/api/v1/auth/dropbox/connector/callback + # -- Composio -- # COMPOSIO_API_KEY= # COMPOSIO_ENABLED=TRUE diff --git a/surfsense_backend/.env.example b/surfsense_backend/.env.example index 0cdb581c4..bca1ba411 100644 --- a/surfsense_backend/.env.example +++ b/surfsense_backend/.env.example @@ -101,6 +101,11 @@ MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret_here TEAMS_REDIRECT_URI=http://localhost:8000/api/v1/auth/teams/connector/callback ONEDRIVE_REDIRECT_URI=http://localhost:8000/api/v1/auth/onedrive/connector/callback +# Dropbox Connector +DROPBOX_APP_KEY=your_dropbox_app_key_here +DROPBOX_APP_SECRET=your_dropbox_app_secret_here +DROPBOX_REDIRECT_URI=http://localhost:8000/api/v1/auth/dropbox/connector/callback + # Composio Connector # NOTE: Disable "Mask Connected Account Secrets" in Composio dashboard (Settings → Project Settings) for Google indexing to work. COMPOSIO_API_KEY=your_api_key_here diff --git a/surfsense_backend/app/agents/new_chat/chat_deepagent.py b/surfsense_backend/app/agents/new_chat/chat_deepagent.py index 2ac00151b..e2df5dff5 100644 --- a/surfsense_backend/app/agents/new_chat/chat_deepagent.py +++ b/surfsense_backend/app/agents/new_chat/chat_deepagent.py @@ -84,6 +84,7 @@ _CONNECTOR_TYPE_TO_SEARCHABLE: dict[str, str] = { "BOOKSTACK_CONNECTOR": "BOOKSTACK_CONNECTOR", "CIRCLEBACK_CONNECTOR": "CIRCLEBACK", # Connector type differs from document type "OBSIDIAN_CONNECTOR": "OBSIDIAN_CONNECTOR", + "DROPBOX_CONNECTOR": "DROPBOX_FILE", # Connector type differs from document type "ONEDRIVE_CONNECTOR": "ONEDRIVE_FILE", # Connector type differs from document type # Composio connectors (unified to native document types). # Reverse of NATIVE_TO_LEGACY_DOCTYPE in app.db. @@ -317,6 +318,12 @@ async def create_surfsense_deep_agent( ] modified_disabled_tools.extend(google_drive_tools) + has_dropbox_connector = ( + available_connectors is not None and "DROPBOX_FILE" in available_connectors + ) + if not has_dropbox_connector: + modified_disabled_tools.extend(["create_dropbox_file", "delete_dropbox_file"]) + has_onedrive_connector = ( available_connectors is not None and "ONEDRIVE_FILE" in available_connectors ) diff --git a/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py b/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py index cd4914f15..c24497bfd 100644 --- a/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py +++ b/surfsense_backend/app/agents/new_chat/tools/knowledge_base.py @@ -202,6 +202,7 @@ _ALL_CONNECTORS: list[str] = [ "CIRCLEBACK", "OBSIDIAN_CONNECTOR", "ONEDRIVE_FILE", + "DROPBOX_FILE", ] # Human-readable descriptions for each connector type @@ -232,6 +233,7 @@ CONNECTOR_DESCRIPTIONS: dict[str, str] = { "CIRCLEBACK": "Circleback meeting notes, transcripts, and action items", "OBSIDIAN_CONNECTOR": "Obsidian vault notes and markdown files (personal notes)", "ONEDRIVE_FILE": "Microsoft OneDrive files and documents (personal cloud storage)", + "DROPBOX_FILE": "Dropbox files and documents (cloud storage)", } @@ -360,6 +362,7 @@ _INTERNAL_METADATA_KEYS: frozenset[str] = frozenset( "calendar_id", "google_drive_file_id", "onedrive_file_id", + "dropbox_file_id", "page_id", "issue_id", "connector_id", diff --git a/surfsense_backend/app/config/__init__.py b/surfsense_backend/app/config/__init__.py index b38d7fd1d..1fabfc7b6 100644 --- a/surfsense_backend/app/config/__init__.py +++ b/surfsense_backend/app/config/__init__.py @@ -292,6 +292,11 @@ class Config: CLICKUP_CLIENT_SECRET = os.getenv("CLICKUP_CLIENT_SECRET") CLICKUP_REDIRECT_URI = os.getenv("CLICKUP_REDIRECT_URI") + # Dropbox OAuth + DROPBOX_APP_KEY = os.getenv("DROPBOX_APP_KEY") + DROPBOX_APP_SECRET = os.getenv("DROPBOX_APP_SECRET") + DROPBOX_REDIRECT_URI = os.getenv("DROPBOX_REDIRECT_URI") + # Composio Configuration (for managed OAuth integrations) # Get your API key from https://app.composio.dev COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")