Skip to content

Conversation

jessicasingh7
Copy link
Contributor

@jessicasingh7 jessicasingh7 commented Sep 26, 2025

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Additional Options

  • [Optional] Override Linear Check

@jessicasingh7 jessicasingh7 requested a review from a team as a code owner September 26, 2025 18:56
Copy link

vercel bot commented Sep 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
internal-search Ready Ready Preview Comment Sep 26, 2025 11:09pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR implements source selection improvements by enabling all sources by default for new users and persisting user preferences in localStorage. The changes include:

  • Frontend: Modified ActionToggle component to load saved source preferences from localStorage, defaulting to all sources enabled for first-time users, and persisting changes back to localStorage
  • Backend: Added null check in federated retrieval to properly handle cases where no source types are specified
  • UI Cleanup: Removed source chips from chat input bar since sources are now managed within the ActionToggle component

The implementation follows React best practices with proper state management, localStorage integration for persistence, and maintains backward compatibility. The backend change ensures federated connectors are properly skipped when no sources are selected.

Confidence Score: 4/5

  • This PR is safe to merge with minor style improvements needed
  • The implementation is solid with proper error handling and state management, but has one minor style issue with missing type annotations that should be addressed according to custom instructions
  • ActionManagement.tsx needs a minor type annotation fix for the filter function parameter

Important Files Changed

File Analysis

Filename        Score        Overview
backend/onyx/federated_connectors/federated_retrieval.py 5/5 Added null check for source_types to properly skip federated connectors when none specified
web/src/app/chat/components/input/ActionManagement.tsx 4/5 Added localStorage persistence for source selection preferences and default-enable-all behavior
web/src/app/chat/components/input/ChatInputBar.tsx 5/5 Removed source chips from filter display and passed filterManager to ActionToggle component

Sequence Diagram

sequenceDiagram
    participant User
    participant ChatInputBar
    participant ActionToggle
    participant FilterManager
    participant LocalStorage
    participant Backend

    User->>ChatInputBar: Opens chat interface
    ChatInputBar->>ActionToggle: Renders with filterManager prop
    ActionToggle->>LocalStorage: Check for saved source preferences
    
    alt First time user (no saved preferences)
        ActionToggle->>ActionToggle: Enable all available sources by default
        ActionToggle->>FilterManager: setSelectedSources(allSources)
        ActionToggle->>LocalStorage: Save default selection
    else Existing user (has saved preferences)
        LocalStorage->>ActionToggle: Return saved preferences
        ActionToggle->>ActionToggle: Validate saved sources against available
        ActionToggle->>FilterManager: setSelectedSources(validSavedSources)
    end

    User->>ActionToggle: Toggles source selection
    ActionToggle->>FilterManager: Update selected sources
    ActionToggle->>LocalStorage: Persist new selection
    
    User->>ChatInputBar: Submits query
    ChatInputBar->>Backend: Send query with selected sources
    
    alt source_types is None
        Backend->>Backend: Skip federated connectors
        Backend->>ChatInputBar: Return results without federated data
    else source_types provided
        Backend->>Backend: Filter federated connectors by source_types
        Backend->>ChatInputBar: Return results with federated data
    end
Loading

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

if (savedSources !== null) {
const availableSourceMetadata = getConfiguredSources(availableSources);
const validSavedSources = savedSources.filter(
(savedSource: SourceMetadata) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: explicit type annotation missing for savedSource parameter

Suggested change
(savedSource: SourceMetadata) =>
(savedSource: SourceMetadata) =>

Context Used: Context - Use explicit type annotations for variables to enhance code clarity, especially when moving type hints around in the code. (link)

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/app/chat/components/input/ActionManagement.tsx
Line: 479:479

Comment:
style: explicit type annotation missing for `savedSource` parameter

```suggestion
          (savedSource: SourceMetadata) =>
```
**Context Used:** **Context -** Use explicit type annotations for variables to enhance code clarity, especially when moving type hints around in the code. ([link](https://app.greptile.com/review/custom-context?memory=f234365d-3144-4a85-994f-1e9dd56f6cc2))

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@Weves Weves merged commit eedd2ba into main Sep 27, 2025
55 of 57 checks passed
@Weves Weves deleted the jessica/source-filter-enable-all branch September 27, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants