Commit graph

27 commits

Author SHA1 Message Date
google-labs-jules[bot]
4bf09b8bde I've added comprehensive unit and integration tests for the recently implemented Slack connector features. This includes tests for backend logic (SlackHistory, indexing tasks, API routes) and frontend components and hooks.
Backend Tests (`surfsense_backend`):
- `test_slack_history.py`:
    - Tests for `SlackHistory` class methods including `get_all_channels`,
      `get_conversation_history`, timestamp conversions, and message
      formatting. Covers various API response scenarios, pagination,
      and error handling.
- `test_connectors_indexing_tasks.py`:
    - Unit tests for `index_slack_messages` task.
    - Scenarios include initial indexing, periodic indexing, on-demand
      re-indexing (targeted channels, force re-index, custom dates),
      channel filtering, and error handling.
    - Mocks `SlackHistory` and database interactions.
- `test_search_source_connectors_routes.py`:
    - Tests for `/slack/{connector_id}/discover-channels` endpoint.
    - Tests for `/slack/{connector_id}/reindex-channels` endpoint,
      verifying parameter passing to the background task.
    - Tests for the main `/search-source-connectors/{connector_id}/index`
      endpoint for Slack connectors, ensuring the `force_full_reindex`
      flag is handled.

Frontend Tests (`surfsense_web`):
- `components/editConnector/EditSlackConnectorConfigForm.test.tsx`:
    - Tests rendering of all Slack configuration fields.
    - Verifies `onConfigChange` callback functionality.
    - Tests conditional rendering of periodic indexing settings.
    - Checks disabled state of the form.
- `app/dashboard/[search_space_id]/connectors/[connector_id]/edit/page.test.tsx`:
    - Tests for the "Channel Management" tab specific to Slack connectors.
    - Verifies UI for discovering channels (mocking API calls).
    - Tests selection of channels and updating the connector configuration.
    - Tests UI for triggering on-demand re-indexing with various options.
- `hooks/useSearchSourceConnectors.test.ts`:
    - Unit tests for the `discoverSlackChannels` function, mocking `fetch`.
    - Unit tests for the `reindexSlackChannels` function, mocking `fetch`
      and verifying correct request body construction.
    - Includes testing of the `fetchWithAuth` helper function.
2025-05-28 10:48:28 +00:00
google-labs-jules[bot]
d1f11d4fbb feat: Enhance Slack Connector Functionality
I've implemented several improvements and new features for the Slack connector,
addressing your requirements for more granular control over indexing
and data synchronization.

Key changes include:

Backend (`surfsense_backend`):
- I've updated the `SearchSourceConnector` schema for Slack to include new
  configuration options:
    - `slack_periodic_indexing_enabled` (boolean)
    - `slack_periodic_indexing_frequency` (string: "daily", "weekly", "monthly")
    - `slack_max_messages_per_channel_periodic` (integer)
- I've modified the `index_slack_messages` task:
    - It now supports on-demand re-indexing of specific `target_channel_ids`.
    - It allows `force_reindex_all_messages` to override `last_indexed_at`
      for specified channels, using initial indexing settings or custom
      date ranges (`reindex_start_date_str`, `reindex_latest_date_str`).
    - It uses `slack_max_messages_per_channel_periodic` for regular
      periodic updates.
- I've updated the Slack Connector Routes:
    - The `/slack/{connector_id}/reindex-channels` endpoint now accepts
      `channel_ids`, `force_reindex_all_messages`, `reindex_start_date`,
      and `reindex_latest_date` to trigger targeted re-indexing.
    - The main `/connector/{id}/index` endpoint for Slack can now accept
      `force_full_reindex` to re-index all configured channels from scratch.

Frontend (`surfsense_web`):
- I've created `EditSlackConnectorConfigForm.tsx` to provide a dedicated UI
  for Slack connector settings, including the new periodic indexing fields.
- I've integrated this form into the main connector editing page
  (`.../connectors/[connector_id]/edit/page.tsx`).
- I've enhanced the Slack connector edit page with a "Channel Management" tab:
    - UI for discovering Slack channels via `/api/v1/slack/{id}/discover-channels`.
    - Allows selection of channels to be saved into
      `config.slack_selected_channel_ids` when membership filter is "selected".
    - UI for triggering on-demand re-indexing of selected channels via
      `/api/v1/slack/{id}/reindex-channels`, with options for forcing
      full re-index and specifying date ranges.
- I've updated the `useSearchSourceConnectors.ts` hook:
    - I've added the `discoverSlackChannels` function.
    - I've added the `reindexSlackChannels` function with parameters for
      channel IDs, force flag, and date ranges.

These changes fulfill your requirements for:
1. Configurable Membership/Join Behavior (via existing `slack_membership_filter_type` and new channel selection UI).
2. Configurable Periodic Indexing (new backend schema and UI fields).
3. Granular Channel Selection (new UI for discovering and selecting channels).
4. On-Demand Re-index (new backend and UI capabilities for specific channels).
5. Initial Indexing Timestamp Range (I've verified existing backend logic and UI).
2025-05-28 09:36:25 +00:00
google-labs-jules[bot]
d40de3bce2 feat: Enhance Slack connector with advanced configuration
This commit introduces Phase 1 of Slack connector enhancements, providing more granular control over the indexing process.

Key changes include:

1.  **Updated Connector Configuration Schema (`search_source_connector.py`):**
    *   Added new fields to `SearchSourceConnector.config` for Slack:
        *   `slack_membership_filter_type`: ("all_member_channels", "selected_member_channels")
        *   `slack_selected_channel_ids`: List of channel IDs for selective indexing.
        *   `slack_indexing_frequency`: For periodic re-indexing schedule.
        *   `slack_initial_indexing_days`: Depth for initial message import.
        *   `slack_initial_max_messages_per_channel`: Max messages for initial import.
    *   Updated Pydantic validation logic for these new fields.

2.  **Modified Indexing Task (`connectors_indexing_tasks.py`):**
    *   `index_slack_messages` now reads and utilizes the new configuration fields.
    *   Channel filtering is applied based on `slack_membership_filter_type` and `slack_selected_channel_ids`.
    *   Initial indexing runs use `slack_initial_indexing_days` and `slack_initial_max_messages_per_channel` to determine the scope of the first message fetch.
    *   The Slack API call was changed from `get_history_by_date_range` to a direct call to `get_conversation_history` using more precise timestamp-based parameters (`oldest`, `latest`) and message limits.

3.  **New API Endpoint for Channel Discovery (`search_source_connectors_routes.py`):**
    *   Added `GET /connectors/slack/{connector_id}/discover-channels`.
    *   This endpoint allows the frontend to fetch a list of channels where the bot is currently a member, facilitating your selection for indexing.

4.  **New API Endpoint for Specific Channel Re-index Trigger (`search_source_connectors_routes.py`):**
    *   Added `POST /slack/{connector_id}/reindex-channels`.
    *   This endpoint is structured to accept a list of channel IDs for targeted re-indexing.
    *   Note: The underlying modification to `index_slack_messages` to fully handle the specialized logic for these targeted re-indexes (ignoring last_indexed_at, etc.) was not completed. This endpoint sets up the route and request model.

These changes lay the backend foundation for a more configurable and user-friendly Slack integration. Frontend implementation for these configurations and the completion of the specific channel re-indexing logic are pending.
2025-05-28 09:20:06 +00:00
DESKTOP-RTLN3BA\$punk
a8080d2dc7 feat: Added Speech to Text support.
- Supports audio & video files.
- Will be useful for Youtube vids which dont have transcripts.
2025-05-13 21:13:53 -07:00
DESKTOP-RTLN3BA\$punk
a9db0a8ceb feat: Introduce the RAPTOR Search. 2025-05-11 23:05:56 -07:00
DESKTOP-RTLN3BA\$punk
a58550818b feat: Added chat_history to researcher agent 2025-05-10 20:06:19 -07:00
DESKTOP-RTLN3BA\$punk
1586a0bd78 chore: Added direct handling for markdown files.
- Fixed podcast imports.
2025-05-07 22:04:57 -07:00
DESKTOP-RTLN3BA\$punk
b4bee887bd feat: Added Podcast Feature and its actually fast.
- Fully Async
2025-05-05 23:18:12 -07:00
DESKTOP-RTLN3BA\$punk
130f43a0fa feat: Removed GPT-Researcher in favour of own SurfSense LangGraph Agent 2025-04-20 19:19:35 -07:00
DESKTOP-RTLN3BA\$punk
2008b07304 fix: Docs & Chats in other search spaces 2025-04-17 23:19:56 -07:00
Adamsmith6300
32c721113c update edit connectors page to support linear connector 2025-04-16 22:06:50 -07:00
Adamsmith6300
f2f426d5eb merge conflicts 2025-04-16 21:34:51 -07:00
Adamsmith6300
5176569e30 edit repos for gh connector 2025-04-16 20:29:50 -07:00
Adamsmith6300
ae8c74a5aa select repos when adding gh connector 2025-04-16 19:59:38 -07:00
DESKTOP-RTLN3BA\$punk
e0eb9d4b8b feat: Added Linear Connector 2025-04-15 23:10:35 -07:00
Adamsmith6300
a69bbb32f7 Merge branch 'main' of https://github.com/MODSetter/SurfSense into add-github-connector 2025-04-14 15:25:29 -07:00
DESKTOP-RTLN3BA\$punk
aaddd5ca9c Refactor: Remove redundant integer conversion for search_space_id in chat data handling 2025-04-13 20:53:21 -07:00
DESKTOP-RTLN3BA\$punk
0b93c9dfef Fixed current agent citation issues and added sub_section_writer agent for upcoming SurfSense research agent 2025-04-13 20:47:23 -07:00
Adamsmith6300
bb198e38c0 add github connector, add alembic for db migrations, fix bug updating connectors 2025-04-13 13:56:22 -07:00
DESKTOP-RTLN3BA\$punk
b43272a115 feat(youtube): integrate YouTube video processing connector
- Added support for processing YouTube videos, including transcript extraction and document creation.
- Implemented a new background task for adding YouTube video documents.
- Enhanced the connector service to search for YouTube videos and return relevant results.
- Updated frontend components to include YouTube video options in the dashboard and connector sources.
- Added necessary dependencies for YouTube transcript API.
2025-04-11 15:05:17 -07:00
DESKTOP-RTLN3BA\$punk
1609e59086 YouTube video processing utils 2025-04-09 18:46:10 -07:00
DESKTOP-RTLN3BA\$punk
8cd1264d3f feat: Updated the extension for SurfSense v0.0.6 2025-03-26 20:02:53 -07:00
DESKTOP-RTLN3BA\$punk
24fd873ca7 fix: Fixed Slack Reindexing 2025-03-26 17:44:38 -07:00
DESKTOP-RTLN3BA\$punk
23da404177 fix: Fixed Notion Reindexing & Updation 2025-03-26 17:19:10 -07:00
DESKTOP-RTLN3BA\$punk
ee0c518553 not-integreated: Add DocumentHybridSearchRetriever 2025-03-20 22:56:24 -07:00
DESKTOP-RTLN3BA\$punk
709aa6f303 feat: Added Docker Support and missing dependencies. 2025-03-20 18:52:06 -07:00
DESKTOP-RTLN3BA\$punk
da23012970 feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00