A full-stack AI-powered chatbot that allows users to upload PDFs, images, or text, ask questions, and receive answers with cited sources and synthesized themes. The app supports document selection, context highlighting, loading animation, read-aloud functionality
- Multi-file Upload: Upload PDFs (typed or scanned), images, and/or enter text.
- Selective Search: Choose which uploaded files to include/exclude from search via checkboxes.
- Document Preview: Preview PDFs and images in-app.
- Contextual Q&A: Ask questions and get answers with cited sources and extracted context.
- Synthesized Theme Answers: See both individual document answers (tabular) and a synthesized, theme-based summary.
- Source Navigation: Click citations to jump to the relevant file and page.
- Expandable Context: Expand/collapse extracted context for easier reading.
- Read Aloud: Listen to answers with play, pause, resume, and stop controls.
- Modern UI: Responsive, accessible, and styled with Tailwind CSS and React Icons.
- Frontend: Next.js (with hooks), Tailwind CSS, React Icons, ReactMarkdown
- Backend: Flask, Flask-SocketIO, SentenceTransformers (all-MiniLM-L6-v2), PyMuPDF, FAISS
- Vector Search: FAISS
- OCR: pytesseract (for scanned PDFs and images)
- WebSocket: Real-time Q&A via Flask-SocketIO
- Node.js & npm
- Python 3.8+
- pip
-
Install dependencies:
pip install -r requirements.txt
-
Run the backend:
python backend/app/server.py
-
Install dependencies:
cd frontend/my-app npm install -
Run the frontend:
npm run dev
-
Access the app:
Open http://localhost:3000 in your browser.
- Upload PDFs, images, or enter text.
- Select which files to include in search using checkboxes.
- Ask a question in the chat box.
- View answers with cited sources and synthesized themes.
- Click citations to jump to the relevant file/page.
- Expand context for detailed view.
- Listen to answers using the read-aloud controls.
| Document ID | Extracted Answer | Citation |
|---|---|---|
| DOC001 | The order states that the fine was imposed... | Page 4, Para 2 |
| DOC002 | Tribunal observed delay in disclosure... | Page 2, Para 1 |
chatbot_theme_identifier/
├── backend/
│ └── app/
│ └── server.py
├── frontend/
│ └── my-app/
│ └── src/
│ └── app/
│ └── page.jsx
├── requirements.txt
└── README.md