How bl8dyg1rl/conversational_commerce_chatbot_mantis works
MANTIS es un asistente conversacional de comercio: un cliente envía una consulta por Telegram, WhatsApp o la API; el backend extrae la intención con Ollama, actualiza el contexto conversacional, consulta el catálogo real y compone una respuesta basada en productos e inventario persistidos en PostgreSQL. También soporta recomendaciones, búsqueda, stock, presupuestos, memoria y selección interactiva. Las rutas de WhatsApp y algunos endpoints no fueron muestreados completamente; sus conexiones se limitan a lo documentado y visible.
Components 18
Interfaces
- Telegram Adapter
backend/app/telegram_bot.py - WhatsApp Webhook
backend/app/api/whatsapp.py - FastAPI Backend
backend/app/main.py - Chat API
backend/app/api/chat.py - Product API
backend/app/api/products.py
Conversación
- Chat Orchestrator
backend/app/services/chat_service.py - Intent Extractor
backend/app/services/llm_service.py - Ollama LLM
- Response Composer
backend/app/services/response_service.py - Product Selection
backend/app/telegram_bot.py
Comercio
- Product Search
backend/app/services/search_service.py - Recommendations
backend/app/services/recommendation_service.py
Persistencia
- Product Catalog
backend/app/models/product.py - Conversation Records
backend/app/models/conversation.py - Message Records
backend/app/models/message.py - Conversation Context
backend/app/models/conversation_context.py - PostgreSQL
backend/app/core/database.py
Other components
- Cliente
Connections 30
- Cliente → Telegram Adapter: sends messages
- Cliente → WhatsApp Webhook: sends messages
- Cliente → FastAPI Backend: calls API
- FastAPI Backend → Chat API: routes chat
- FastAPI Backend → Product API: routes products
- Telegram Adapter → Chat Orchestrator: processes message
- WhatsApp Webhook → Chat Orchestrator: processes message
- Chat API → Chat Orchestrator: processes message
- Chat Orchestrator → Intent Extractor: extracts intent
- Intent Extractor → Ollama LLM: calls model
- Chat Orchestrator → Conversation Records: loads conversation
- Chat Orchestrator → Message Records: writes messages
- Chat Orchestrator → Conversation Context: updates context
- Chat Orchestrator → Recommendations: gets products
- Chat Orchestrator → Response Composer: generates response
- Recommendations → Product Search: searches catalog
- Product Search → Product Catalog: reads products
- Response Composer → Product Search: searches products
- Response Composer → Product Catalog: reads stock
- Product API → Product Catalog: reads catalog
- Chat Orchestrator → Telegram Adapter: returns response
- Chat Orchestrator → WhatsApp Webhook: returns result
- Telegram Adapter → Product Selection: dispatches clicks
- Product Selection → Product Catalog: reads product
- Product Selection → Conversation Context: stores selection
- Product Selection → Message Records: records selection
- Product Catalog → PostgreSQL: persists catalog
- Conversation Records → PostgreSQL: persists conversations
- Message Records → PostgreSQL: persists messages
- Conversation Context → PostgreSQL: persists context