How pavankbhat/chat-bot works
This is a React/Django conversational AI app: users register or sign in, select or create a conversation, send a message, and see a Gemini response saved with conversation history. The frontend also supports history browsing, renaming, and deletion; the backend scopes chat data to authenticated users and includes recent conversation context in prompts. Edges among sampled modules follow explicit imports and calls. Frontend-to-backend HTTP links are dashed because the excerpts do not show the server routing/configuration that connects them.
Main entry points: views.py Conversation endpoints · chatLayout.tsx Chat layout · App.tsx App session gate · chatApi.ts Chat API client
Components 19
Frontend experience
- App session gate
frontend/src/App.tsx - Login and signup
frontend/src/pages/login.tsx - Auth API client
frontend/src/api/authApi.ts - Chat layout
frontend/src/pages/chatLayout.tsx - Top navigation
frontend/src/components/topNav.tsx - History controls
frontend/src/components/sideNav.tsx - Chat window
frontend/src/components/chatWindow.tsx - Chat API client
frontend/src/api/chatApi.ts
Identity and access
- User endpoints
backend/users/views.py - User serializers
backend/users/serializers.py - User records
backend/users/models.py - User routes
backend/users/urls.py
Conversation services
- Conversation endpoints
backend/api/views.py - Conversation serializers
backend/api/serializers.py - Conversation and messages
backend/api/models.py - Chat routes
backend/api/urls.py
External systems
- Gemini API
- PostgreSQL
Other components
- User
Connections 19
- User → App session gate: opens app
- App session gate → Login and signup: shows when unauthenticated
frontend/src/App.tsx - App session gate → Chat layout: shows when signed in
frontend/src/App.tsx - Login and signup → Auth API client: submits credentials
frontend/src/pages/login.tsx - Auth API client → User endpoints: posts auth requests
- User routes → User endpoints: routes requests
backend/users/urls.py - User endpoints → User serializers: validates credentials
backend/users/views.py - User serializers → User records: creates users
backend/users/serializers.py - Chat layout → Top navigation: renders
frontend/src/pages/chatLayout.tsx - Chat layout → History controls: renders
frontend/src/pages/chatLayout.tsx - Chat layout → Chat window: renders
frontend/src/pages/chatLayout.tsx - History controls → Chat API client: manages history through
frontend/src/components/sideNav.tsx - Chat window → Chat API client: loads and sends through
frontend/src/components/chatWindow.tsx - Chat API client → Conversation endpoints: requests chat operations
- Chat routes → Conversation endpoints: routes requests
backend/api/urls.py - Conversation endpoints → Conversation and messages: reads and writes
backend/api/views.py - Conversation endpoints → Conversation serializers: serializes responses
backend/api/views.py - Conversation endpoints → Gemini API: sends prompt
backend/api/views.py - Conversation and messages → PostgreSQL: persists chat history
Readme.md