Skip to content

Latest commit

 

History

History
177 lines (144 loc) · 5.96 KB

File metadata and controls

177 lines (144 loc) · 5.96 KB

E-Commerce Customer Support AI Chatbot - Implementation Plan

Project Overview

Build an intelligent, multilingual customer support chatbot for e-commerce platforms that leverages NLP and machine learning to provide instant, accurate responses in both English and Urdu.

Tech Stack

Frontend

  • Framework: React with TypeScript
  • Build Tool: Vite
  • Styling: CSS with design tokens (glassmorphism)
  • State Management: Zustand
  • HTTP Client: Axios

Backend

  • Runtime: Bun.js
  • Framework: Hono.js
  • Language: TypeScript
  • Database: MongoDB (Mongoose)
  • Cache: Redis

AI/ML Layer

  • LLM Integration: Groq API
  • Agent Framework: Custom multi-agent orchestration

DevOps

  • Containerization: Docker & Docker Compose
  • Logging: Pino

System Architecture

┌─────────────────────────────────────────────────────────┐
│                     Frontend (React)                     │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │
│  │ Chat Widget  │  │ Order Track  │  │ Product Info │  │
│  └──────────────┘  └──────────────┘  └──────────────┘  │
└────────────────────────┬────────────────────────────────┘
                         │ REST API
┌────────────────────────▼────────────────────────────────┐
│                Backend (Hono.js + Bun)                   │
│  ┌──────────────────────────────────────────────────┐  │
│  │              AI Agent Orchestrator                │  │
│  │    ┌──────────┐  ┌──────────┐  ┌──────────┐     │  │
│  │    │  Intent  │  │  FAQ     │  │ Order    │     │  │
│  │    │  Agent   │  │  Agent   │  │ Agent    │     │  │
│  │    └──────────┘  └──────────┘  └──────────┘     │  │
│  │    ┌──────────┐  ┌──────────┐                    │  │
│  │    │ Product  │  │ Language │                    │  │
│  │    │ Agent    │  │ Agent    │                    │  │
│  │    └──────────┘  └──────────┘                    │  │
│  └──────────────────────────────────────────────────┘  │
└────────────┬────────────────┬──────────────────────────┘
             │                │
    ┌────────▼────────┐  ┌───▼──────┐
    │   MongoDB       │  │  Redis   │
    │ (Conversations, │  │ (Cache,  │
    │  Products, FAQs)│  │ Sessions)│
    └─────────────────┘  └──────────┘

AI Agents

1. Intent Classification Agent

Analyzes user message and determines intent:

  • greeting
  • faq_query
  • order_tracking
  • product_inquiry
  • complaint
  • feedback
  • other

2. Language Detection & Translation Agent

  • Detects language (Urdu/English)
  • Translates if needed
  • Maintains conversation context

3. FAQ Agent

  • Searches FAQ database
  • Semantic matching
  • Returns answer in user's language

4. Order Tracking Agent

  • Order lookup by ID, email, or phone
  • Status updates
  • Tracking information

5. Product Information Agent

  • Product search
  • Details retrieval
  • Availability check

6. Chat Orchestrator

Coordinates between agents:

  1. User Message → Language Agent
  2. Translated Message → Intent Agent
  3. Route to Specialized Agent
  4. Generate Response
  5. Translate back if needed
  6. Return to User

API Endpoints

Chat

  • POST /api/v1/chat/message - Process user message
  • POST /api/v1/chat/session - Create new session
  • GET /api/v1/chat/session/:id - Get history
  • DELETE /api/v1/chat/session/:id - End session

Orders

  • GET /api/v1/orders - List orders
  • GET /api/v1/orders/:id - Get order details
  • GET /api/v1/orders/track/:tracking - Track order

Products

  • GET /api/v1/products - List products
  • GET /api/v1/products/search - Search products
  • GET /api/v1/products/:id - Get product

FAQs

  • GET /api/v1/faqs - List FAQs
  • GET /api/v1/faqs/search - Search FAQs

Database Models

Conversation

  • sessionId, userId, platform
  • messages (role, content, language, timestamp)
  • status, sentiment

FAQ

  • question (en, ur)
  • answer (en, ur)
  • category, keywords, priority

Product

  • name (en, ur), description (en, ur)
  • category, price, stock, images

Order

  • orderId, userId, status
  • items, total, shipping info, tracking

Key Features

Multilingual Support

  • Automatic language detection
  • Translation between English and Urdu
  • RTL support for Urdu
  • Context preservation

FAQ Handling

  • Semantic search
  • Category filtering
  • Confidence scoring
  • Fallback to general AI

Order Tracking

  • Multiple search methods
  • Real-time status
  • Visual timeline

Product Information

  • NLP-based search
  • Recommendations
  • Stock information

Future Enhancements

  • Voice support
  • Image recognition
  • Live agent handoff
  • Analytics dashboard
  • More languages
  • Shopify/WooCommerce integration