How puneet987720-creator/ai-chatbot works
This is a mobile/web conversational assistant with a Laravel API. Users authenticate, send messages, and manage conversation history; the backend retrieves document context, calls Gemini, and stores messages. The frontend also presents chat content and history. Backend control flow is supported by controller and service excerpts; some frontend-to-API details and authentication-provider wiring are not shown, so those links are omitted or marked unverified.
Main entry points: ChatbotController.php Chat API · chatBot.ts API client · chatTab.tsx Chat screen · VectorSearchService.php Context retrieval
Components 19
Client experience
- Sign-in screen
chatbot-frontend/app/index.tsx - Chat screen
chatbot-frontend/app/(drawer)/chatTab.tsx - Message views
chatbot-frontend/component/assistantContent.tsx - User message view
chatbot-frontend/component/userContent.tsx - History screen
chatbot-frontend/app/(drawer)/sideTab.tsx - History item
chatbot-frontend/component/chatHistory.tsx - API client
chatbot-frontend/api/chatBot.ts - Token storage
chatbot-frontend/utils/getToken.tsx
API and auth
- Chat API
chatbot-backend/app/Http/Controllers/Api/ChatbotController.php - API routing
chatbot-backend/routes/api.php - User authentication
chatbot-backend/app/Http/Controllers/userAuth.php
Conversation domain
- Conversations
chatbot-backend/app/Models/Conversation.php - Messages
chatbot-backend/app/Models/Message.php - User account
chatbot-backend/app/Models/User.php
Knowledge and generation
- Context retrieval
chatbot-backend/app/Services/VectorSearchService.php - Embedded documents
chatbot-backend/app/Models/Document.php - Gemini service
chatbot-backend/app/Services/OpenAiService.php
Other components
- User
- Google Gemini
Connections 19
- User → Sign-in screen: signs in
chatbot-frontend/app/index.tsx - User → Chat screen: chats
- Sign-in screen → API client: imports
chatbot-frontend/app/index.tsx - API client → Token storage: gets token
chatbot-frontend/api/chatBot.ts - History screen → API client: uses
chatbot-frontend/app/(drawer)/sideTab.tsx - History screen → History item: renders
chatbot-frontend/app/(drawer)/sideTab.tsx - Chat screen → Message views: renders
chatbot-frontend/app/(drawer)/chatTab.tsx - Chat screen → User message view: renders
chatbot-frontend/app/(drawer)/chatTab.tsx - API client → Chat API: sends requests
- API routing → Chat API: routes to
chatbot-backend/routes/api.php - API routing → User authentication: routes to
chatbot-backend/routes/api.php - Chat API → Conversations: creates and reads
chatbot-backend/app/Http/Controllers/Api/ChatbotController.php - Chat API → Messages: reads and writes
chatbot-backend/app/Http/Controllers/Api/ChatbotController.php - Chat API → Context retrieval: retrieves context
chatbot-backend/app/Http/Controllers/Api/ChatbotController.php - Chat API → Gemini service: requests completion
chatbot-backend/app/Http/Controllers/Api/ChatbotController.php - Context retrieval → Gemini service: generates embedding
chatbot-backend/app/Services/VectorSearchService.php - Context retrieval → Embedded documents: queries embeddings
chatbot-backend/app/Services/VectorSearchService.php - Gemini service → Google Gemini: calls API
chatbot-backend/app/Services/OpenAiService.php - Conversations → Messages: relates messages
chatbot-backend/app/Models/Conversation.php