Product Catalog Chatbot with AI-Enhanced Management System
An intelligent product catalog management platform powered by Docker Model Runner, AI Agents, and Event-Driven Architecture. This system combines conversational AI, intelligent agents, and real-time processing for comprehensive catalog management.
๐ฏ System Overviewโ
This is a complete AI-enhanced catalog management system featuring:
๐ค Core AI Componentsโ
- Chatbot Interface - Natural language product queries and conversations
- AI Agent Service - Automated vendor evaluation, market research, and customer matching
- MCP Gateway - Model Context Protocol for AI tool orchestration
- Model Runner Integration - Local AI model execution with Llama 3.2
๐๏ธ Complete Architectureโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Agent Portal โ โ Chatbot UI โ
โ Port: 5173 โ โ Port: 3001 โ โ Port: 5174 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโดโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Backend API โ โ Agent Service โ โ Chatbot API โ
โ Port: 3000 โ โ Port: 7777 โ โ Port: 8082 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโฌโโโโโโโโโโดโโโโโโโโโโฌโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ MCP Gateway โ โ Model Runner โ
โ Port: 8811 โ โ (Local AI) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ PostgreSQL โ โ MongoDB โ โ Kafka โ
โ Port: 5432 โ โ Port: 27017 โ โ Port: 9092 โ
โ (Products DB) โ โ (Agent History) โ โ (Event Stream) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐ Quick Startโ
Prerequisitesโ
- Docker Desktop with Model Runner enabled
- At least 8GB RAM (4GB+ for AI models)
- Docker Compose v2.0+
1. Pull Required Modelsโ
# Pull the AI model for chatbot and agents
docker model pull ai/llama3.2:1B-Q8_0
2. Start All Servicesโ
# Clone the repository
git clone https://github.com/ajeetraina/catalog-service-node-chatbot.git
cd catalog-service-node-chatbot
# Start the complete system
docker compose up -d --build
3. Access the Applicationsโ
| Service | URL | Description |
|---|---|---|
| ๐ค Chatbot Interface | http://localhost:5174 | Main chatbot for product queries |
| ๐ Main Frontend | http://localhost:5173 | Product catalog management |
| ๐ง Agent Portal | http://localhost:3001 | AI agent management interface |
| ๐ Kafka UI | http://localhost:8080 | Event streaming monitoring |
| ๐๏ธ pgAdmin | http://localhost:5050 | Database administration |
๐ฌ Chatbot Capabilitiesโ
Note: After running
sh add-products.sh, your chatbot will have access to 50+ sample products for testing these capabilities.
Natural Language Product Searchโ
User: "Show me all electronics under $500"
Chatbot: "I found 8 electronics products under $500:
๐ฑ iPhone SE - $399.00
Compact smartphone with A15 Bionic chip
๐ง Sony WH-1000XM5 - $399.00
Industry-leading noise canceling headphones
โ Apple Watch - $249.00
Advanced health and fitness tracking
[Additional products...]
Would you like details about any specific product?"
Intelligent Category Browsingโ
User: "What's popular in home electronics?"
Chatbot: "Based on our catalog data:
๐ Smart Home Category (12 products):
โข Smart speakers: 4 products ($49-199)
โข Security cameras: 3 products ($89-299)
โข Smart thermostats: 2 products ($149-249)
โข Home automation hubs: 3 products ($99-349)
The Amazon Echo Dot and Ring Doorbell are our top sellers.
Which type of smart home device interests you?"
Catalog Analyticsโ
User: "Give me a summary of the catalog"
Chatbot: "Here's your catalog overview:
๐ **Catalog Statistics:**
โข Total Products: 127
โข Active Categories: 8
โข Price Range: $9.99 - $2,499.00
โข Average Price: $186.45
โข New This Week: 5 products
๐ฅ **Top Categories:**
1. Electronics (34 products)
2. Clothing (28 products)
3. Home & Garden (21 products)
Is there a specific category you'd like to explore?"
๐ค AI Agent Systemโ
The system includes intelligent agents powered by Model Runner:
๐ Vendor Intake Agentโ
- Purpose: Evaluates new product submissions
- Scoring: 0-100 AI-powered evaluation
- Criteria: Product quality, market fit, pricing analysis
- Integration: Kafka events trigger automatic evaluation
๐ Market Research Agentโ
- Purpose: Automated competitor analysis
- Features: Price comparison, feature analysis, market positioning
- Data Sources: Web scraping, API integrations via MCP Gateway
- Output: Comprehensive market reports
๐ฏ Customer Match Agentโ
- Purpose: Analyzes customer preferences and buying patterns
- Intelligence: ML-based recommendation engine
- Personalization: Tailored product suggestions
- History: Stored in MongoDB for continuous learning
๐ Catalog Management Agentโ
- Purpose: Maintains and optimizes product catalog
- Automation: Auto-categorization, price updates, inventory sync
- Quality Control: Duplicate detection, data validation
- Optimization: SEO improvements, description enhancement
โ๏ธ Model Runner Configurationโ
Supported Modelsโ
| Model | Size | Performance | Use Case |
|---|---|---|---|
ai/llama3.2:1B-Q4_0 | 1GB | Fast | Chatbot, basic agents |
ai/llama3.2:1B-Q8_0 | 1.5GB | Balanced | Recommended |
ai/llama3.2:3B-Q4_0 | 2GB | High Quality | Complex agent tasks |
Environment Configurationโ
# Model Runner integration in compose.yaml
models:
llama_model:
model: ai/llama3.2:1B-Q8_0
# Services using Model Runner
chatbot-backend:
models:
llama_model:
endpoint_var: MODEL_RUNNER_URL
model_var: MODEL_RUNNER_MODEL
agent-service:
models:
llama_model:
endpoint_var: MODEL_RUNNER_URL
model_var: MODEL_RUNNER_MODEL
mcp-gateway:
models:
llama_model:
endpoint_var: MODEL_RUNNER_URL
model_var: MODEL_RUNNER_MODEL
๐ง Core Services Deep Diveโ
Chatbot Backend (chatbot-backend)โ
- Port: 8082
- Purpose: Natural language processing for product queries
- AI Integration: Direct Model Runner connection
- Database: PostgreSQL for product data
- Features: Intent recognition, smart search, conversation context
Agent Service (agent-service)โ
- Port: 7777
- Purpose: AI agents for automation and intelligence
- Event Processing: Kafka-based event handling
- Databases: PostgreSQL (catalog) + MongoDB (history)
- Agents: Vendor evaluation, market research, customer matching
MCP Gateway (mcp-gateway)โ
- Port: 8811
- Purpose: AI tool orchestration and integration
- Protocols: Server-Sent Events (SSE) transport
- Tools: fetch, brave, resend, curl, mongodb
- Role: Enables agents to access external data sources
Backend API (backend)โ
- Port: 3000
- Purpose: Core catalog management API
- Database: PostgreSQL primary, MongoDB secondary
- Integration: Agent service communication
- Features: CRUD operations, vendor management, analytics
๐ Event-Driven Architectureโ
Kafka Integrationโ
# Kafka configuration for real-time processing
kafka:
image: apache/kafka:latest
ports: ["9092:9092", "9093:9093"]
# Event flow examples:
# 1. New product โ Agent evaluation โ Catalog update
# 2. User query โ Agent research โ Enhanced response
# 3. Price change โ Market analysis โ Competitive insights
Event Typesโ
- Product Events: Creation, updates, deletions
- Agent Events: Evaluation results, research findings
- User Events: Interactions, preferences, feedback
- System Events: Health checks, performance metrics
๐๏ธ Database Architectureโ
PostgreSQL (Primary Database)โ
-- Core product catalog
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
category VARCHAR(100),
price DECIMAL(10, 2),
vendor_id VARCHAR(100),
ai_score INTEGER, -- AI evaluation score
status VARCHAR(20) DEFAULT 'active',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Vendor management
CREATE TABLE vendors (
id VARCHAR(100) PRIMARY KEY,
name VARCHAR(255),
evaluation_score INTEGER,
status VARCHAR(20)
);
MongoDB (Agent History)โ
// Agent interaction history
{
agentType: "vendor_evaluation",
productId: "12345",
evaluation: {
score: 85,
reasoning: "High quality, competitive pricing",
criteria: ["quality", "price", "market_fit"]
},
timestamp: "2025-01-15T10:30:00Z"
}
// Customer interaction patterns
{
sessionId: "abc123",
interactions: [
{ query: "electronics under $200", results: 5 },
{ action: "view_product", productId: "67890" }
],
preferences: ["electronics", "budget_conscious"]
}
๐ ๏ธ API Endpointsโ
Chatbot API (localhost:8082)โ
# Natural language chat
POST /api/chat
{
"message": "Show me laptops for programming"
}
# Product search with filters
GET /api/products/search?q=laptop&category=electronics&maxPrice=1500
# Get conversation context
GET /api/context/{sessionId}
Agent Service API (localhost:7777)โ
# Trigger vendor evaluation
POST /api/agents/evaluate-vendor
{
"vendorId": "tech_corp_001",
"products": ["product_123", "product_456"]
}
# Get market research report
GET /api/agents/market-research/{productId}
# Customer preference analysis
POST /api/agents/analyze-customer
{
"customerId": "user_789",
"interactionHistory": [...]
}
Main Backend API (localhost:3000)โ
# Product management
GET /api/products
POST /api/products
PUT /api/products/{id}
DELETE /api/products/{id}
# Vendor management
GET /api/vendors
POST /api/vendors
GET /api/vendors/{id}/evaluation
# Analytics
GET /api/analytics/summary
GET /api/analytics/trends
๐ Development & Testingโ
Local Development Setupโ
# Start infrastructure only
docker compose up postgres mongodb kafka -d
# Run services locally for development
cd chatbot-backend && npm run dev # Port 8082
cd agent-service && npm run dev # Port 7777
cd backend && npm run dev # Port 3000
Health Checksโ
# Check all service health
curl http://localhost:3000/health # Backend
curl http://localhost:8082/health # Chatbot
curl http://localhost:7777/health # Agents
curl http://localhost:8811/health # MCP Gateway
# Check Model Runner status
docker model ls
docker model info ai/llama3.2:1B-Q8_0
Testing the Chatbotโ
# Test natural language queries
curl -X POST http://localhost:8082/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "What are your most expensive electronics?"}'
# Test product search
curl "http://localhost:8082/api/products/search?q=smartphone&maxPrice=800"
# Test category lookup
curl http://localhost:8082/api/categories
๐ Monitoring & Observabilityโ
Service Monitoringโ
- Kafka UI: http://localhost:8080 - Event stream monitoring
- pgAdmin: http://localhost:5050 - Database monitoring
- Docker Logs:
docker compose logs [service-name] - Health Endpoints: Built-in health checks for all services
Performance Metricsโ
# Check resource usage
docker stats
# Monitor model performance
docker model stats ai/llama3.2:1B-Q8_0
# View service logs
docker compose logs -f chatbot-backend
docker compose logs -f agent-service
๐ Adding Products & Dataโ
Automated Product Importโ
# Use the provided import script
./add-products.sh
# Or use the Node.js automation script
npm run import-products
Testing with Sample Dataโ
The system includes comprehensive sample data:
- 50+ Products across multiple categories
- Vendor Information with AI evaluations
- Mock Market Data for agent testing
- Customer Interaction Patterns for recommendation testing
๐ Production Considerationsโ
Securityโ
- Environment Variables: Use Docker secrets for production
- Network Security: Configure proper firewall rules
- Database Security: Enable PostgreSQL/MongoDB authentication
- API Security: Implement rate limiting and authentication
Scalingโ
- Horizontal Scaling: Multiple instances of each service
- Database Sharding: Partition large datasets
- Model Optimization: Use quantized models for performance
- Caching: Redis for frequently accessed data
Deploymentโ
# Production environment variables
environment:
- NODE_ENV=production
- MODEL_RUNNER_URL=${MODEL_RUNNER_URL}
- POSTGRES_HOST=${POSTGRES_HOST}
- KAFKA_BROKERS=${KAFKA_BROKERS}
- MONGODB_URI=${MONGODB_URI}
๐ฏ Quick Start Checklistโ
- Pull AI Model:
docker model pull ai/llama3.2:1B-Q8_0 - Start Services:
docker compose up -d --build - Import Products:
./add-products.sh - Test Chatbot: Visit http://localhost:5174
- Check Agents: Visit http://localhost:3001
- Monitor System: Visit http://localhost:8080