How phucthinh2704/plantsenseai-llm works
PlantSense is an agricultural chatbot with a React client and FastAPI/MongoDB backend. The principal workflow is a user submitting a question or image, the chat service classifying it and producing a response, then persisting the conversation. The application also provides authentication, plant/disease/cultivation information, and admin management and indexing screens. Edges are limited to relationships shown in excerpts or SOURCE INDEX references; several frontend-to-API and unsampled indexing details are not established, so they are left unconnected.
Main entry points: main.py API application · plant_router.py Plant endpoints · routes.jsx Route map · chat_service.py Chat orchestration
Components 24
Web client
- Route map
frontend/src/app/Router/routes.jsx - Chat screen
frontend/src/pages/Home.jsx - Login screen
frontend/src/pages/Login.jsx - Admin screens
frontend/src/pages/admin
API and identity
- API application
backend_mdb/app/main.py - Auth endpoints
backend_mdb/app/router/auth_router.py - Auth logic
backend_mdb/app/services/auth_service.py - User service
backend_mdb/app/services/user_service.py - MongoDB
backend_mdb/app/core/database.py - Chat endpoint
backend_mdb/app/router/chat_router.py - Conversation endpoints
backend_mdb/app/router/conversation_router.py
Chat and knowledge
- Chat orchestration
backend_mdb/app/services/chat_service.py - Image classifier
backend_mdb/app/classification/classify.py - Chat prompts
backend_mdb/app/prompts/chat_prompts.py - Conversation service
backend_mdb/app/services/conversation_service.py - Search indexing
backend_mdb/app/indexing.py - Index tokenizer
backend_mdb/app/indexing_tokenizer.py
Agricultural data
- Plant endpoints
backend_mdb/app/router/plant_router.py - Plant service
backend_mdb/app/services/plant_service.py - Disease service
backend_mdb/app/services/disease_service.py - Disease-stage service
backend_mdb/app/services/disease_stage_service.py - Cultivation service
backend_mdb/app/services/cultivation_service.py - Domain endpoints
backend_mdb/app/router
Other components
- User
Connections 25
- User → Route map: opens app
frontend/src/app/Router/routes.jsx - Route map → Chat screen: routes home
frontend/src/app/Router/routes.jsx - Route map → Login screen: routes login
frontend/src/app/Router/routes.jsx - Route map → Admin screens: routes admin
frontend/src/app/Router/routes.jsx - API application → Auth endpoints: registers
backend_mdb/app/main.py - API application → Chat endpoint: registers
backend_mdb/app/main.py - API application → Conversation endpoints: registers
backend_mdb/app/main.py - API application → Plant endpoints: registers
backend_mdb/app/main.py - API application → Domain endpoints: registers
backend_mdb/app/main.py - Auth endpoints → Auth logic: delegates Google login
backend_mdb/app/router/auth_router.py - Auth endpoints → User service: manages accounts
backend_mdb/app/router/auth_router.py - Auth logic → User service: looks up users
backend_mdb/app/services/auth_service.py - User service → MongoDB: reads and writes
backend_mdb/app/services/user_service.py - Chat endpoint → Chat orchestration: dispatches chat
backend_mdb/app/router/chat_router.py - Chat orchestration → Image classifier: classifies images
backend_mdb/app/services/chat_service.py - Chat orchestration → Chat prompts: uses prompts
backend_mdb/app/services/chat_service.py - Chat orchestration → Conversation service: loads and saves
backend_mdb/app/services/chat_service.py - Conversation endpoints → Conversation service: delegates conversation
backend_mdb/app/router/conversation_router.py - Conversation service → MongoDB: persists conversations
backend_mdb/app/services/conversation_service.py - Plant endpoints → Plant service: manages plants
backend_mdb/app/router/plant_router.py - Plant endpoints → Disease service: creates disease data
backend_mdb/app/router/plant_router.py - Plant endpoints → Disease-stage service: creates disease stages
backend_mdb/app/router/plant_router.py - Plant endpoints → Cultivation service: creates techniques
backend_mdb/app/router/plant_router.py - Admin screens → Search indexing
- Search indexing → Index tokenizer