CodeForPhilly / CodeForPhilly/balancer-main

[Insight Extractor] Feature Request: Chat History Not Persisting in PDF View

Open
#373 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### 📌 Feature: Persist Chat per PDF

**User Story**
As a user, when I open a PDF in Balancer and use the right-hand chat, I want my conversation to be saved and reloaded the next time I view the same PDF, so I don’t lose context.

---

### 📝 Current Behavior
- Chat panel resets each time a PDF is opened.
- No previous messages are shown.

---

### 🎯 Expected Behavior
- Chat is **persisted per PDF** (and per user).
- Reopening the same PDF reloads the full conversation history.
- Different PDFs have separate, isolated chats.
- Conversations persist after page refresh or navigation.

---

### ✅ Acceptance Criteria
- [ ] Chat history is stored in the database and linked to both `user` and `pdf`.
- [ ] On PDF open, existing chat history is automatically loaded.
- [ ] New messages are appended to the saved conversation.
- [ ] Switching between PDFs loads the correct chat history for each file.
- [ ] Refreshing the page does not clear conversation history.

---

### 🔨 Task Breakdown
- [ ] **Backend**
- Ensure chat messages are stored per `user` + `pdf`.
- Expose endpoint to fetch conversation history for a given PDF.
- Append new messages to existing conversation.

- [ ] **Frontend**
- On PDF open, fetch and render chat history.
- Append new messages in real time while preserving history.
- Ensure chat state resets correctly when switching PDFs.

- [ ] **QA**
- Verify chat persists after closing/reopening a PDF.
- Verify chats are isolated across PDFs.
- Verify persistence after page reload.

Image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.