Commit graph

374 commits

Author SHA1 Message Date
FBLGit
16c7dedba0
Merge pull request #4 from fblgit/feature/slack-connector-enhancements
fix: Correct import for EditSlackConnectorConfigForm
2025-05-29 10:43:36 +07:00
google-labs-jules[bot]
babed51889 fix: Correct import for EditSlackConnectorConfigForm
Changes the import statement in
`surfsense_web/app/dashboard/[search_space_id]/connectors/[connector_id]/edit/page.tsx`
to correctly use a default import for `EditSlackConnectorConfigForm`
from `@/components/editConnector/EditSlackConnectorConfigForm`.

This resolves an "Attempted import error" where the component was
previously imported as a named export.
2025-05-29 03:42:21 +00:00
FBLGit
1ebcbbe017
Merge pull request #3 from fblgit/feature/slack-connector-enhancements
fix: Correct syntax error in EditSlackConnectorConfigForm
2025-05-29 10:25:44 +07:00
google-labs-jules[bot]
ac4bc76d4e fix: Correct syntax error in EditSlackConnectorConfigForm
Removes an extraneous closing JSX fragment tag (`</>`) at the end of
the file `surfsense_web/components/editConnector/EditSlackConnectorConfigForm.tsx`
that was causing a compilation error.
2025-05-29 03:25:00 +00:00
FBLGit
df42eccb72
Merge pull request #2 from fblgit/feature/slack-connector-enhancements
I've added comprehensive unit and integration tests for the recently …
2025-05-28 17:51:06 +07:00
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
FBLGit
527678a979
Merge pull request #1 from fblgit/feature/slack-connector-enhancements
feat: Enhance Slack Connector Functionality
2025-05-28 16:39:50 +07: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
google-labs-jules[bot]
3aa719802f Refactor: Skip Slack channels where bot is not a member
I modified the Slack indexing process in `index_slack_messages` to skip any channel (public or private) where the bot's `is_member` status is false.

Previously, the indexing process would only explicitly skip private channels where the bot was not a member. For public channels, it would attempt to fetch history, relying on a `not_in_channel` error during history fetching to implicitly skip.

This change makes the skipping behavior explicit for all channel types based on the `is_member` flag retrieved from `conversations.list` API call. This aims to reduce unnecessary API calls to `conversations.history` for channels the bot hasn't been invited to, potentially speeding up the indexing process and avoiding hitting rate limits unnecessarily.

The `is_member` flag is reliably provided by the `SlackHistory.get_all_channels` method. Logging messages have been updated to reflect this change.
2025-05-28 06:00:08 +00:00
Rohan Verma
fd6da4c472
Merge pull request #117 from fblgit/fix/slack-rate-limiting
Fix/slack rate limiting & Github Repos ORG Filtering
2025-05-27 18:39:15 -07:00
google-labs-jules[bot]
379694c267 Hotfix: Remove non-printable characters from slack_history.py
This commit addresses recurring `SyntaxError: invalid non-printable character U+001B`
errors in `surfsense_backend/app/connectors/slack_history.py`.

The file was cleaned to remove all occurrences of the
U+001B (ESCAPE) character. This ensures that previously introduced
problematic control characters are fully removed, allowing the application
to parse and load the module correctly.
2025-05-27 13:44:56 +00:00
google-labs-jules[bot]
299bb35d8c Hi there, it's Jules! I've just finished making some improvements.
Here's a rundown of what I did:

Fix: Robust Slack rate limiting, error handling & GitHub org repos

This update delivers comprehensive improvements to Slack connector stability and enhances the GitHub connector.

**Slack Connector (`slack_history.py`, `connectors_indexing_tasks.py`):**
- I've implemented proactive delays (1.2s for `conversations.history`, 3s for `conversations.list` pagination) and `Retry-After` header handling for 429 rate limit errors across `conversations.list`, `conversations.history`, and `users.info` API calls.
- I'll now gracefully handle `not_in_channel` errors when fetching conversation history by logging a warning and skipping the channel.
- I've refactored channel info fetching: `get_all_channels` now returns richer channel data (including `is_member`, `is_private`).
- I've removed direct calls to `conversations.info` from `connectors_indexing_tasks.py`, using the richer data from `get_all_channels` instead, to prevent associated rate limits.
- I corrected a `SyntaxError` (non-printable character) in `slack_history.py`.
- I've enhanced logging for rate limit actions, delays, and errors.
- I've updated unit tests in `test_slack_history.py` to cover all new logic.

**GitHub Connector (`github_connector.py`):**
- I've modified `get_user_repositories` to fetch all repositories accessible by you (owned, collaborated, organization) by changing the API call parameter from `type='owner'` to `type='all'`.
- I've included unit tests in `test_github_connector.py` for this change.
2025-05-27 13:39:42 +00:00
google-labs-jules[bot]
ce1014c8c2 Fix: Handle Slack rate limits and add GitHub org repo support
This commit includes two main improvements:

1. Slack Connector (`slack_history.py`):
   - Addresses API rate limiting for `conversations.list` by introducing a 3-second delay between paginated calls.
   - Implements handling for the `Retry-After` header when HTTP 429 errors occur.
   - Fixes a `SyntaxError` caused by a non-printable character accidentally introduced in a previous modification.
   - Adds comprehensive unit tests for the rate limiting and retry logic in `test_slack_history.py`.

2. GitHub Connector (`github_connector.py`):
   - Modifies `get_user_repositories` to fetch all repositories accessible by you (including organization repositories) by changing the API call parameter from `type='owner'` to `type='all'`.
   - Adds unit tests in `test_github_connector.py` to verify this change and other connector functionalities.
2025-05-27 13:27:10 +00:00
google-labs-jules[bot]
807c83b2f6 Fix: Handle Slack API rate limiting for conversations.list
The `get_all_channels` method in `slack_history.py` was making paginated
requests to `conversations.list` without any delay, leading to HTTP 429
errors when fetching channels from large Slack workspaces.

This commit introduces the following changes:
- Adds a 3-second delay between paginated calls to `conversations.list`
  to comply with Slack's Tier 2 rate limits (approx. 20 requests/minute).
- Implements handling for the `Retry-After` header when a 429 error is
  received. The system will wait for the specified duration before
  retrying. If the header is missing or invalid, a default of 60 seconds
  is used.
- Adds comprehensive unit tests to verify the new delay and retry logic,
  covering scenarios with and without the `Retry-After` header, as well
  as other API errors.
2025-05-27 12:56:26 +00:00
Rohan Verma
5fef58bdf9
Merge pull request #112 from MODSetter/dev
Version Bump beta-v0.0.7
2025-05-22 00:16:27 -07:00
DESKTOP-RTLN3BA\$punk
38516e74f9 Version Bump 2025-05-22 00:11:57 -07:00
Rohan Verma
be8cbbe7b6
Merge pull request #111 from MODSetter/dev
fix: Added Suspense boundary in Login Page
2025-05-21 21:16:55 -07:00
DESKTOP-RTLN3BA\$punk
604791e6c5 fix: Added Suspense boundary in Login Page 2025-05-21 21:13:56 -07:00
Rohan Verma
94c79130f1
Merge pull request #110 from MODSetter/dev
feat: Removed Hard Dependency on Google Auth
2025-05-21 21:05:19 -07:00
DESKTOP-RTLN3BA\$punk
521ee4a1c4 feat: Removed Hard Dependecy on Google Auth
- Introduced LOCAL auth mode
2025-05-21 20:56:23 -07:00
Rohan Verma
c290146a8d
Merge pull request #109 from MODSetter/dev
feat: Code Block Syntax Highlighting & Copy Func
2025-05-19 23:29:43 -07:00
DESKTOP-RTLN3BA\$punk
4c8b03ce2b feat: Code Block Syntax Highlighting & Copy Func 2025-05-19 23:19:20 -07:00
Rohan Verma
8c58fc417e
Merge pull request #108 from MODSetter/dev
feat: Improved prompt for personalised responses
2025-05-19 20:56:13 -07:00
DESKTOP-RTLN3BA\$punk
33f7860969 Merge branch 'dev' of https://github.com/MODSetter/SurfSense into dev 2025-05-19 20:49:50 -07:00
DESKTOP-RTLN3BA\$punk
ad13d815a5 refactor: Improved prompt for personalization. 2025-05-19 20:49:47 -07:00
DESKTOP-RTLN3BA\$punk
f824842ec3 refactor: Improved prompt for personalization. 2025-05-19 20:48:48 -07:00
Rohan Verma
23b48e5945
Merge pull request #107 from MODSetter/dev
feat: Basic sub_writer_graph streaming
2025-05-16 01:57:52 -07:00
DESKTOP-RTLN3BA\$punk
8a23d43e8a Merge branch 'dev' of https://github.com/MODSetter/SurfSense into dev 2025-05-16 01:51:59 -07:00
DESKTOP-RTLN3BA\$punk
c7a173456a feat: Basic Streaming 2025-05-16 01:51:55 -07:00
DESKTOP-RTLN3BA\$punk
0bf43571ba feat: Basic Streaming 2025-05-16 01:51:03 -07:00
Rohan Verma
2a269e901b
Merge pull request #103 from cubxxw/feat/add-pr-template
Add PR template with enhanced checklist for SurfSense
2025-05-14 10:45:30 -07:00
Xinwei Xiong
aadd9e20e5 Add PR template with enhanced checklist for SurfSense 2025-05-14 16:40:28 +08:00
Rohan Verma
f291f441c0
Merge pull request #96 from cubxxw/feat/optimize-docker-compose
refactor: remove frontend and backend services
2025-05-13 23:19:12 -07:00
Xinwei Xiong
e8eac2deb0 docs: update deployment guide and Docker setup documentation to use 'docker compose' syntax 2025-05-14 14:00:30 +08:00
Xinwei Xiong
6d591094cc docs: update Docker setup documentation with deployment options and configuration details 2025-05-14 13:18:51 +08:00
Xinwei Xiong
bfeae0cb67 refactor: remove frontend and backend services from docker-compose.yml 2025-05-14 13:12:22 +08:00
Rohan Verma
e3d8e8a75d
Merge pull request #94 from MODSetter/dev
feat: Added Speech to Text support.
2025-05-13 21:21:32 -07:00
DESKTOP-RTLN3BA\$punk
0885f39feb Merge branch 'dev' of https://github.com/MODSetter/SurfSense into dev 2025-05-13 21:13:58 -07: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
4d5fb212df 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:11 -07:00
Rohan Verma
57987ecc76
Merge pull request #93 from mpawank/main
seo optimization
2025-05-13 20:30:07 -07:00
mpawank
445e02b71b removed changes from readme 2025-05-14 08:54:40 +05:30
mpawank
9d5dd56306 removed change from r 2025-05-14 08:49:52 +05:30
mpawank
288798ade4 updated seo 2025-05-14 01:22:25 +05:30
mpawank
9ccbf848e8 updated layout.tsx for better seo 2025-05-14 00:55:22 +05:30
mpawank
6e6bb3972f mpawanl 2025-05-13 15:19:00 +05:30
Rohan Verma
1d1523a891
Merge pull request #88 from ritikprajapat21/main
Fix #33: Refactored code
2025-05-11 23:59:17 -07:00
Rohan Verma
29f4d90a0a
Merge pull request #90 from MODSetter/dev
feat: Introduce RAPTOR Search Mode
2025-05-11 23:15:39 -07:00
DESKTOP-RTLN3BA\$punk
9284e93a33 Merge branch 'dev' of https://github.com/MODSetter/SurfSense into dev 2025-05-11 23:06:11 -07:00