Feature/Project Proposal
I propose implementing full-stack chat history persistence so the conversation state survives page refreshes by saving the message thread to the database under the active session.
Problem Statement

Currently, when interacting with the AI Assistant on the platform, reloading or refreshing the page completely wipes out the active chat history. For an interview preparation tool, this causes significant friction as users lose valuable insights, feedback, and conversational context if their browser reloads.
Proposed Solution
Proposed Implementation Plan:
- Database Models (
backend/models/Session.js): Verify and update the schema to include a messages array to store conversation history (role, text, and createdAt).
- Backend Logic (
backend/controllers/aiController.js): Modify the AI generation controller to accept a sessionId. After fetching the Gemini AI response, asynchronously push both the user prompt and the AI text into the corresponding session document in MongoDB.
- Backend Logic (
backend/controllers/sessionController.js): Ensure the controller handling GET /api/sessions/:id returns the populated message history alongside the session metadata.
- Frontend UI(
src/components/AIHelper.jsx )& (frontend/src/pages/InterviewPrep/): Capture the session ID via URL parameters in the parent interview page route on mount, fetch the message history, and pass it down to AIHelper.jsx to rehydrate the chat state so previous messages render seamlessly.
Alternatives Considered
No response
Benefits
Prevents Data Loss: Currently, because the system relies on a temporary array, any accidental page reload or browser crash completely wipes out the user's interview progress and the feedback they received. Maintains AI
Conversational Context: The AI's accuracy relies entirely on the history array passed to it. The aiRoutes.js file specifically maps this history array to inform the Gemini model of past interactions. If this history is wiped on a refresh, the AI completely forgets the context of the mock interview, resulting in a disconnected and frustrating user experience.
Enables Future Review: By saving the chat history to the database, users will be able to return to older sessions and view to review past performance and specific AI feedback long after the session has ended.
Priority
None
Additional Context
No response
Checklist
Feature/Project Proposal
I propose implementing full-stack chat history persistence so the conversation state survives page refreshes by saving the message thread to the database under the active session.
Problem Statement
Proposed Solution
Proposed Implementation Plan:
backend/models/Session.js): Verify and update the schema to include amessagesarray to store conversation history (role,text, andcreatedAt).backend/controllers/aiController.js): Modify the AI generation controller to accept asessionId. After fetching the Gemini AI response, asynchronously push both the user prompt and the AI text into the corresponding session document in MongoDB.backend/controllers/sessionController.js): Ensure the controller handlingGET /api/sessions/:idreturns the populated message history alongside the session metadata.src/components/AIHelper.jsx)& (frontend/src/pages/InterviewPrep/): Capture the session ID via URL parameters in the parent interview page route on mount, fetch the message history, and pass it down to AIHelper.jsx to rehydrate the chat state so previous messages render seamlessly.Alternatives Considered
No response
Benefits
Prevents Data Loss: Currently, because the system relies on a temporary array, any accidental page reload or browser crash completely wipes out the user's interview progress and the feedback they received. Maintains AI
Conversational Context: The AI's accuracy relies entirely on the history array passed to it. The aiRoutes.js file specifically maps this history array to inform the Gemini model of past interactions. If this history is wiped on a refresh, the AI completely forgets the context of the mock interview, resulting in a disconnected and frustrating user experience.
Enables Future Review: By saving the chat history to the database, users will be able to return to older sessions and view to review past performance and specific AI feedback long after the session has ended.
Priority
None
Additional Context
No response
Checklist