Skip to content

Feature/multi document selection#545

Open
hrshjswniii wants to merge 7 commits into
param20h:devfrom
hrshjswniii:feature/Multi-Document-Selection
Open

Feature/multi document selection#545
hrshjswniii wants to merge 7 commits into
param20h:devfrom
hrshjswniii:feature/Multi-Document-Selection

Conversation

@hrshjswniii

Copy link
Copy Markdown
Contributor

🔗 Related Issue


Closes #540



📝 What does this PR do?


This PR implements multi-document selection chat, enabling users to scope their RAG chat sessions to exactly a selected subset of files in their active workspace.

Key Enhancements:

  1. RAG Pipeline Enhancements (Backend):
    • Updated retrieve(), PDFSearchTool, _candidate_graphs, get_entity_context, and agent execution helpers to accept a list of document_ids and verify read authorization checks for each document.
    • Updated the retrieve function tracing decorator signature to accept **kwargs so that capturing parameters like document_ids and workspace doesn't cause TypeErrors.
  2. Chat Router & Cache Integration (Backend):
    • Enhanced WebSocket (chat_ws) and SSE (ask_question, ask_question_stream) route handlers to parse, validate readiness/ownership, and save multi-document messages with document_id = None.
    • Cached responses using a sorted comma-joined string representation of the selection list.
  3. Sidebar Checkbox Integration (Frontend):
    • Added checkboxes and active selection highlights inside DocumentSidebar.tsx to toggle documents in the selection list.
    • Added a dynamic header badge indicating the number of selected files (e.g., "3 selected").
  4. Chat Scoping and Input Fields (Frontend):
    • Updated dashboard state logic in page.tsx to manage and clear selectedDocIds when changing workspaces or switching active documents.
    • Enhanced empty states and textarea placeholders inside ChatPanel.tsx to reflect the multi-file scope (e.g. "Chatting with 3 selected files").
    • Updated chat payloads to forward document_ids instead of document_id when checkboxes are active, and hid the clear/export buttons for multi-document chats to prevent invalid operations.


🗂️ Type of Change


  • 🐛 Bug fix
  • ✨ New feature
  • 🔧 Refactor / code cleanup
  • 📝 Documentation update
  • 🎨 UI / styling change
  • ⚙️ CI / tooling / config change
  • 🧪 Tests


🧪 How was this tested?


  • Tested the affected API endpoints manually
  • Added / updated tests
    • Added unit test test_retrieve_with_document_ids_list_and_rbac_checks in [test_retriever.py]
    • Added unit test test_chat_ask_success_with_document_ids in [test_chat.py]
    • Updated mock signatures in [test_rag_tools.py]
    • Verified all 162 backend tests pass successfully (backend\.venv\Scripts\python -m pytest backend/tests)
  • Ran frontend local typecheck and compilation (npx tsc --noEmit completed with no compilation errors)


@hrshjswniii hrshjswniii requested a review from param20h as a code owner June 9, 2026 20:02
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.

[FEAT] : Multi-Document Selection Chat

1 participant