Skip to content

feat: display AI-generated document summary in sidebar after ingestion#657

Open
vivek0369 wants to merge 2 commits into
param20h:devfrom
vivek0369:feat/document-summary-ui
Open

feat: display AI-generated document summary in sidebar after ingestion#657
vivek0369 wants to merge 2 commits into
param20h:devfrom
vivek0369:feat/document-summary-ui

Conversation

@vivek0369

Copy link
Copy Markdown
Contributor

feat: display AI-generated document summary in sidebar after ingestion

Description

Closes #<ISSUE_NUMBER>

This PR completes the existing document summarization feature by surfacing AI-generated document summaries in the frontend sidebar after document ingestion.

The project already contains the necessary backend infrastructure:

  • Document.summary column (Column(Text, nullable=True))
  • backend/app/rag/summarizer.py
  • Document ingestion pipeline that generates and stores summaries

However, although summaries were being generated and persisted, they were never displayed in the user interface.

This contribution bridges that gap by updating the document sidebar to render document summaries in a clean, collapsible format, allowing users to quickly understand uploaded content before starting a conversation.


Changes Made

Frontend

File Modified

  • frontend/src/components/document/DocumentSidebar.tsx

Implemented

  • Replaced the static summary rendering with a native collapsible <details> / <summary> component.

  • Added an "AI Summary" dropdown beneath each document when a summary is available.

  • Displayed the generated summary text inside the expandable section.

  • Applied existing design-system styling to maintain visual consistency:

    • text-xs
    • text-muted-foreground
    • leading-relaxed
    • mt-1

Example

{doc.summary && (
  <details className="text-xs text-muted-foreground mt-1">
    <summary className="cursor-pointer">
      AI Summary
    </summary>

    <p className="mt-1 leading-relaxed">
      {doc.summary}
    </p>
  </details>
)}

Why This Change Is Valuable

Improved User Experience

Users can immediately view a concise AI-generated overview of their uploaded documents without needing to ask questions first.

Makes Existing AI Functionality Visible

The summarization pipeline was already producing useful information, but users had no way to access it directly.

Low-Risk Enhancement

  • No database migrations required.
  • No API contract changes.
  • No modifications to the ingestion workflow.
  • Uses existing backend-generated data.

Completes a Partially Implemented Feature

This PR connects already-existing backend functionality with the frontend experience, maximizing value from existing code.


Testing Instructions

  1. Start the application.

  2. Upload a supported document (PDF, DOCX, or TXT).

  3. Wait for document ingestion to complete.

  4. Open the document sidebar.

  5. Verify that documents containing summaries display an "AI Summary" dropdown.

  6. Expand the dropdown.

  7. Confirm that:

    • The summary text is rendered correctly.
    • Long summaries wrap properly.
    • The sidebar layout remains intact.
    • Documents without summaries continue to behave normally.

Screenshots

Before

  • Document summaries were generated but not visible to users.

After

  • "AI Summary" dropdown appears beneath uploaded documents.
  • Users can expand/collapse summaries directly from the sidebar.

(Add screenshots here before submission.)


Checklist

  • Feature implemented
  • Existing functionality preserved
  • UI styling follows existing design patterns
  • No database migration required
  • Tested with uploaded documents
  • Linked to related issue

Related Issue

Closes #641

@vivek0369 vivek0369 requested a review from param20h as a code owner June 21, 2026 16:12
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] : Display AI-Generated Document Summary After Ingestion

1 participant