Enhance backend persistence and cleanup LLM service#7
Open
maheshshinde9100 wants to merge 4 commits into
Open
Conversation
- add Dockerfile for FastAPI backend with Python 3.10 slim - add multi-stage Dockerfile for React/Vite frontend with Nginx - add docker-compose configuration for full-stack orchestration - add .dockerignore files to optimize Docker build context - update frontend API service to use VITE_API_URL env variable - update README with Docker setup instructions and corrected project structure
- Link memory service to SQLite database for message persistence
- De-duplicate code in llm.py and improve RAG context handling
- Add DELETE /chat/{session_id} endpoint for history management
- Update frontend API service to handle tokens and session IDs correctly
- Add environment variable validation on backend startup
|
Hey @maheshshinde9100! Saw your work on GSSoC 2026. We are building TermUI, a TypeScript terminal UI framework with React-style hooks and JSX, rendered entirely in the terminal. We have 67 unassigned GSSoC issues open. 19 are marked Karanjot, TermUI maintainer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves backend persistence, refactors the LLM service, and introduces chat management enhancements to improve production readiness and maintainability of the NyayaSetu-AI application.
The update resolves issues related to in-memory chat storage, duplicated LLM logic, inconsistent frontend API handling, and missing chat cleanup functionality.
Closes #6
Changes
Backend
Memory & Persistence
app/services/database.pywithapp/services/memory.pylegal_ai.dbLLM Refactoring
app/services/llm.pyChat Management Endpoint
Added:
Supports clearing/deleting chat history via API
Startup Validation
Updated
app/main.pyAdded startup validation for:
GROQ_API_KEYHF_TOKENImproved configuration error visibility during application startup
Frontend
API Service Improvements
Updated
frontend/src/services/api.jsAdded proper handling for:
session_idtokenChat History Support
clearChatHistory()helper methodChatWindow Integration
ChatWindow.jsxchatIdis passed correctly to backend requestsBenefits
Testing
legal_ai.dbDELETE /chat/{session_id}endpointsession_idFiles Updated
app/services/memory.pyapp/services/database.pyapp/services/llm.pyapp/api/chat.pyapp/main.pyfrontend/src/services/api.jsfrontend/src/components/ChatWindow.jsx