Skip to content

feat: add inline document citation previews in answers#350

Open
Praneeth2711 wants to merge 2 commits into
imDarshanGK:mainfrom
Praneeth2711:feature/inline-citation-previews
Open

feat: add inline document citation previews in answers#350
Praneeth2711 wants to merge 2 commits into
imDarshanGK:mainfrom
Praneeth2711:feature/inline-citation-previews

Conversation

@Praneeth2711

Copy link
Copy Markdown
Contributor

Summary

This PR adds inline document citation previews to answer sources.

Previously, document-backed answers displayed only source filenames. With this change, users can hover a source badge to view a preview of the retrieved document chunk that was used during answer generation.

Changes

Backend

  • Added structured source metadata containing:

    • source filename
    • chunk index
    • preview text
  • Added SourceChunk schema

  • Added backward compatibility for legacy string-based sources

  • Added citation utility helpers

Frontend

  • Preserved existing source badge UI
  • Added hover tooltip previews for source citations
  • Supports both legacy and structured source formats

Compatibility

  • No database migration required
  • Existing sessions continue to load correctly
  • Legacy string sources are automatically normalized

Tests

  • Added citation-focused test suite
  • Added backward compatibility coverage
  • Verified database round-trip behavior
  • Existing tests continue to pass

Notes

  • Citation previews are hover-based in this initial implementation.
  • Historical sessions remain fully supported.

Verification

  • Uploaded document
  • Generated document-backed answer
  • Verified source badges render
  • Verified citation preview tooltip displays retrieved chunk text
  • Verified historical sessions continue to load correctly

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

@Praneeth2711 is attempting to deploy a commit to the Darshan's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant