Skip to content

feat(ai): Implement Document Chat & Summarization (RAG) - #89

Merged
MistryVishwa merged 5 commits into
MistryVishwa:mainfrom
rach-kanc:feat/document-chat-rag
Jul 10, 2026
Merged

feat(ai): Implement Document Chat & Summarization (RAG)#89
MistryVishwa merged 5 commits into
MistryVishwa:mainfrom
rach-kanc:feat/document-chat-rag

Conversation

@rach-kanc

@rach-kanc rach-kanc commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

This Pull Request introduces a native Document Chat feature using Retrieval-Augmented Generation (RAG).

Motivation: Students needed a way to extract insights and generate study materials from long PDFs without leaving the platform or hitting context-window limits in the standard AI Tutor.
Context: We enabled pgvector on Supabase to store document embeddings. PDFs are now parsed server-side using pdf-parse, chunked, and embedded using Gemini's text-embedding-004 model. A new split-screen UI was built so students can view the document and chat with the AI simultaneously.

Related Issue: Closes #78

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Note: This project does not currently have an automated test suite. The following manual verification was performed:

  • API Route Testing: Uploaded a sample PDF and verified the text was successfully extracted, chunked, and embedded into the Supabase document_chunks table without breaking the max duration limit.
  • RPC Function Testing: Ran similarity searches using the match_document_chunks Postgres function to ensure relevant context is fetched for user queries.
  • UI Testing: Verified the split-screen UI renders correctly on desktop and mobile, and the PDF loads properly in the iframe viewer.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings/lint errors
  • I have checked that my branch is up-to-date with main
  • All tests pass locally with my changes (N/A - no local tests exist)

Tags

hard, ssoc26

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@rach-kanc is attempting to deploy a commit to the vishwamistrylearning-1037's projects Team on Vercel.

A member of the Team first needs to authorize it.

@rach-kanc

Copy link
Copy Markdown
Contributor Author

@MistryVishwa Check the PR

@MistryVishwa MistryVishwa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@rach-kanc Please resolve the branch conflicts.

@MistryVishwa MistryVishwa added enhancement New feature or request ssoc26 Main tag identifying the repository for Social Summer of Code 2026 Hard 40 Points labels Jul 10, 2026
@rach-kanc

Copy link
Copy Markdown
Contributor Author

@MistryVishwa fixed the conflicts 👍🏻

@MistryVishwa
MistryVishwa merged commit 6b93ac0 into MistryVishwa:main Jul 10, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Hard 40 Points ssoc26 Main tag identifying the repository for Social Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Document Chat & Summarization (Retrieval-Augmented Generation)

2 participants