Skip to content

Feat/vakil friend chat history persistence api - #1644

Open
Nareshkumawat-star wants to merge 10 commits into
viru0909-dev:mainfrom
Nareshkumawat-star:feat/vakil-friend-chat-history-persistence-api
Open

Feat/vakil friend chat history persistence api#1644
Nareshkumawat-star wants to merge 10 commits into
viru0909-dev:mainfrom
Nareshkumawat-star:feat/vakil-friend-chat-history-persistence-api

Conversation

@Nareshkumawat-star

Copy link
Copy Markdown

Pull Request: Vakil Friend Chat History Persistence API & Session Restoration

Description

Fixes an issue where Vakil Friend AI chat history was maintained only in component state and cleared upon page refreshes, route changes, or opening a new browser tab.

This PR adds backend /api/chat/messages and /api/chat/history REST endpoints and updates VakilFriendPage.jsx to restore active session conversations seamlessly from the database (with a 50-message localStorage fallback).

Closes #1626

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Summary of Changes

  1. Backend (ChatController.java):
    • Created ChatController exposing POST /api/chat/messages to save user and assistant messages to active ChatSession records.
    • Exposed GET /api/chat/history to load the current session's full message history.
  2. Frontend (api.js & VakilFriendPage.jsx):
    • Added chatAPI methods in api.js.
    • Updated session initialization sequence in VakilFriendPage.jsx to fetch chat history from the backend DB upon mount and retain active conversation state.

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
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the CodeBlooded's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Nareshkumawat-star, thanks for contributing to Nyay Setu! 🎉

I have automatically:

  • 👤 Assigned this PR to you.
  • 🏷️ Applied the gssoc:approved label.

Our workflows will now analyze your changes to classify:

  • 📈 PR Difficulty: level:*
  • 🧩 PR Type: type:*
  • 🌟 PR Quality: quality:*

Tip

Ensure your PR description references the issue it resolves (e.g. Closes #123). This allows the bot to inherit any additional labels from that issue!

Happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Chat history in Vakil Friend is lost on page refresh — no persistence between sessions

1 participant