diff --git a/surfsense_backend/alembic/versions/113_add_prompt_library_schema.py b/surfsense_backend/alembic/versions/113_add_prompt_library_schema.py index 191ffcbda..539bf3f69 100644 --- a/surfsense_backend/alembic/versions/113_add_prompt_library_schema.py +++ b/surfsense_backend/alembic/versions/113_add_prompt_library_schema.py @@ -7,6 +7,7 @@ Revises: 112 from collections.abc import Sequence import sqlalchemy as sa + from alembic import op revision: str = "113" @@ -25,8 +26,7 @@ def upgrade() -> None: " ON prompts (is_public) WHERE is_public = true" ) op.execute( - "ALTER TABLE prompts ADD COLUMN IF NOT EXISTS" - " default_prompt_slug VARCHAR(100)" + "ALTER TABLE prompts ADD COLUMN IF NOT EXISTS default_prompt_slug VARCHAR(100)" ) op.execute( "CREATE INDEX IF NOT EXISTS ix_prompts_default_prompt_slug" diff --git a/surfsense_backend/app/agents/new_chat/tools/dropbox/create_file.py b/surfsense_backend/app/agents/new_chat/tools/dropbox/create_file.py index d85ab804e..ed8034861 100644 --- a/surfsense_backend/app/agents/new_chat/tools/dropbox/create_file.py +++ b/surfsense_backend/app/agents/new_chat/tools/dropbox/create_file.py @@ -145,8 +145,7 @@ def create_create_dropbox_file_tool( "name": item["name"], } for item in items - if item.get(".tag") == "folder" - and item.get("name") + if item.get(".tag") == "folder" and item.get("name") ] except Exception: logger.warning( @@ -239,12 +238,12 @@ def create_create_dropbox_file_tool( client = DropboxClient(session=db_session, connector_id=connector.id) parent_path = final_parent_folder_path or "" - file_path = f"{parent_path}/{final_name}" if parent_path else f"/{final_name}" + file_path = ( + f"{parent_path}/{final_name}" if parent_path else f"/{final_name}" + ) if final_file_type == "paper": - created = await client.create_paper_doc( - file_path, final_content or "" - ) + created = await client.create_paper_doc(file_path, final_content or "") file_id = created.get("file_id", "") web_url = created.get("url", "") else: @@ -255,9 +254,7 @@ def create_create_dropbox_file_tool( file_id = created.get("id", "") web_url = "" - logger.info( - f"Dropbox file created: id={file_id}, name={final_name}" - ) + logger.info(f"Dropbox file created: id={file_id}, name={final_name}") kb_message_suffix = "" try: diff --git a/surfsense_backend/app/agents/new_chat/tools/dropbox/trash_file.py b/surfsense_backend/app/agents/new_chat/tools/dropbox/trash_file.py index e10fa3972..e15dc3092 100644 --- a/surfsense_backend/app/agents/new_chat/tools/dropbox/trash_file.py +++ b/surfsense_backend/app/agents/new_chat/tools/dropbox/trash_file.py @@ -248,9 +248,7 @@ def create_delete_dropbox_file_tool( f"Deleting Dropbox file: path='{final_file_path}', connector={actual_connector_id}" ) - client = DropboxClient( - session=db_session, connector_id=actual_connector_id - ) + client = DropboxClient(session=db_session, connector_id=actual_connector_id) await client.delete_file(final_file_path) logger.info(f"Dropbox file deleted: path={final_file_path}") diff --git a/surfsense_backend/app/connectors/dropbox/client.py b/surfsense_backend/app/connectors/dropbox/client.py index 530059143..dfae38f66 100644 --- a/surfsense_backend/app/connectors/dropbox/client.py +++ b/surfsense_backend/app/connectors/dropbox/client.py @@ -225,18 +225,14 @@ class DropboxClient: return all_items, None - async def get_metadata( - self, path: str - ) -> tuple[dict[str, Any] | None, str | None]: + async def get_metadata(self, path: str) -> tuple[dict[str, Any] | None, str | None]: resp = await self._request("/2/files/get_metadata", {"path": path}) if resp.status_code != 200: return None, f"Failed to get metadata: {resp.status_code} - {resp.text}" return resp.json(), None async def download_file(self, path: str) -> tuple[bytes | None, str | None]: - resp = await self._content_request( - "/2/files/download", {"path": path} - ) + resp = await self._content_request("/2/files/download", {"path": path}) if resp.status_code != 200: return None, f"Download failed: {resp.status_code}" return resp.content, None diff --git a/surfsense_backend/app/connectors/dropbox/content_extractor.py b/surfsense_backend/app/connectors/dropbox/content_extractor.py index 226a643c7..e89893b14 100644 --- a/surfsense_backend/app/connectors/dropbox/content_extractor.py +++ b/surfsense_backend/app/connectors/dropbox/content_extractor.py @@ -8,7 +8,6 @@ import contextlib import logging import os import tempfile -from pathlib import Path from typing import Any from .client import DropboxClient diff --git a/surfsense_backend/app/routes/__init__.py b/surfsense_backend/app/routes/__init__.py index d2cf9ff37..983af7597 100644 --- a/surfsense_backend/app/routes/__init__.py +++ b/surfsense_backend/app/routes/__init__.py @@ -9,8 +9,8 @@ from .clickup_add_connector_route import router as clickup_add_connector_router from .composio_routes import router as composio_router from .confluence_add_connector_route import router as confluence_add_connector_router from .discord_add_connector_route import router as discord_add_connector_router -from .dropbox_add_connector_route import router as dropbox_add_connector_router from .documents_routes import router as documents_router +from .dropbox_add_connector_route import router as dropbox_add_connector_router from .editor_routes import router as editor_router from .folders_routes import router as folders_router from .google_calendar_add_connector_route import ( diff --git a/surfsense_backend/app/routes/dropbox_add_connector_route.py b/surfsense_backend/app/routes/dropbox_add_connector_route.py index 8dcaf8c1c..941e5c00f 100644 --- a/surfsense_backend/app/routes/dropbox_add_connector_route.py +++ b/surfsense_backend/app/routes/dropbox_add_connector_route.py @@ -72,9 +72,7 @@ async def connect_dropbox(space_id: int, user: User = Depends(current_active_use if not space_id: raise HTTPException(status_code=400, detail="space_id is required") if not config.DROPBOX_APP_KEY: - raise HTTPException( - status_code=500, detail="Dropbox OAuth not configured." - ) + raise HTTPException(status_code=500, detail="Dropbox OAuth not configured.") if not config.SECRET_KEY: raise HTTPException( status_code=500, detail="SECRET_KEY not configured for OAuth security." diff --git a/surfsense_backend/app/tasks/connector_indexers/dropbox_indexer.py b/surfsense_backend/app/tasks/connector_indexers/dropbox_indexer.py index a16111c53..1b039add7 100644 --- a/surfsense_backend/app/tasks/connector_indexers/dropbox_indexer.py +++ b/surfsense_backend/app/tasks/connector_indexers/dropbox_indexer.py @@ -466,7 +466,9 @@ async def index_dropbox_files( folders = items_dict.get("folders", []) for folder in folders: - folder_path = folder.get("path", folder.get("path_lower", folder.get("id", ""))) + folder_path = folder.get( + "path", folder.get("path_lower", folder.get("id", "")) + ) folder_name = folder.get("name", "Root") logger.info(f"Using full scan for folder {folder_name}") diff --git a/surfsense_web/app/(home)/login/LocalLoginForm.tsx b/surfsense_web/app/(home)/login/LocalLoginForm.tsx index 3d675e56d..ee3b47683 100644 --- a/surfsense_web/app/(home)/login/LocalLoginForm.tsx +++ b/surfsense_web/app/(home)/login/LocalLoginForm.tsx @@ -150,10 +150,7 @@ export function LocalLoginForm() {
-
-
diff --git a/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx b/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx index e4ba1426d..522d71e59 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx @@ -230,7 +230,9 @@ export function PromptsContent() { Cancel @@ -286,21 +288,21 @@ export function PromptsContent() { )}
- +
-
-
- -

- Only sync changes since last index (faster). Disable for a full re-index. -

+
+
+ +

+ Only sync changes since last index (faster). Disable for a full re-index. +

+
+ handleIndexingOptionChange("incremental_sync", checked)} + />
- handleIndexingOptionChange("incremental_sync", checked)} - /> -
-
-
- -

- Recursively index files in subfolders of selected folders -

+
+
+ +

+ Recursively index files in subfolders of selected folders +

+
+ handleIndexingOptionChange("include_subfolders", checked)} + />
- handleIndexingOptionChange("include_subfolders", checked)} - /> -
); diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx index 0db1981d0..ca997a9ba 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx @@ -248,7 +248,7 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam onClick={(e) => { e.preventDefault(); e.stopPropagation(); - setShowDetails(prev => !prev); + setShowDetails((prev) => !prev); }} > {showDetails ? ( diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx index 3a0190e99..b835dbcec 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/onedrive-config.tsx @@ -220,7 +220,7 @@ export const OneDriveConfig: FC = ({ connector, onConfigCh
+
); diff --git a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts index a2762a029..6543bbd72 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts +++ b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts @@ -780,12 +780,12 @@ export const useConnectorDialog = () => { }); } - // Handle Google Drive / OneDrive / Dropbox folder selection (regular and Composio) - if ( - (indexingConfig.connectorType === "GOOGLE_DRIVE_CONNECTOR" || - indexingConfig.connectorType === "COMPOSIO_GOOGLE_DRIVE_CONNECTOR" || - indexingConfig.connectorType === "ONEDRIVE_CONNECTOR" || - indexingConfig.connectorType === "DROPBOX_CONNECTOR") && + // Handle Google Drive / OneDrive / Dropbox folder selection (regular and Composio) + if ( + (indexingConfig.connectorType === "GOOGLE_DRIVE_CONNECTOR" || + indexingConfig.connectorType === "COMPOSIO_GOOGLE_DRIVE_CONNECTOR" || + indexingConfig.connectorType === "ONEDRIVE_CONNECTOR" || + indexingConfig.connectorType === "DROPBOX_CONNECTOR") && indexingConnectorConfig ) { const selectedFolders = indexingConnectorConfig.selected_folders as @@ -1049,13 +1049,13 @@ export const useConnectorDialog = () => { if (!editingConnector.is_indexable) { // Non-indexable connectors (like Tavily API) don't need re-indexing indexingDescription = "Settings saved."; - } else if ( - editingConnector.connector_type === "GOOGLE_DRIVE_CONNECTOR" || - editingConnector.connector_type === "COMPOSIO_GOOGLE_DRIVE_CONNECTOR" || - editingConnector.connector_type === "ONEDRIVE_CONNECTOR" || - editingConnector.connector_type === "DROPBOX_CONNECTOR" - ) { - // Google Drive (both regular and Composio) / OneDrive / Dropbox uses folder selection from config, not date ranges + } else if ( + editingConnector.connector_type === "GOOGLE_DRIVE_CONNECTOR" || + editingConnector.connector_type === "COMPOSIO_GOOGLE_DRIVE_CONNECTOR" || + editingConnector.connector_type === "ONEDRIVE_CONNECTOR" || + editingConnector.connector_type === "DROPBOX_CONNECTOR" + ) { + // Google Drive (both regular and Composio) / OneDrive / Dropbox uses folder selection from config, not date ranges const selectedFolders = (connectorConfig || editingConnector.config)?.selected_folders as | Array<{ id: string; name: string }> | undefined; diff --git a/surfsense_web/components/assistant-ui/thinking-steps.tsx b/surfsense_web/components/assistant-ui/thinking-steps.tsx index b3462da5f..df1cef12c 100644 --- a/surfsense_web/components/assistant-ui/thinking-steps.tsx +++ b/surfsense_web/components/assistant-ui/thinking-steps.tsx @@ -69,7 +69,7 @@ export const ThinkingStepsDisplay: FC<{ steps: ThinkingStep[]; isThreadRunning?:
-