AI-powered customer service system with intelligent conversation management and smart ticket creation.
- π€ Intelligent AI Chat - Local DeepSeek model with conversation memory and context awareness
- π Smart Ticket Creation - Context-aware support escalation with full conversation history
- πΎ Session Management - Persistent conversation history by email with read-only mode for ended sessions
- π Comprehensive Knowledge Base - 70+ automotive Q&A pairs with TF-IDF similarity matching
- π± Responsive Design - Mobile-optimized interface with session history and status indicators
- π Session History - View and continue previous conversations with visual status indicators
- β‘ Auto-Start Services - Ollama AI service management with automatic model checking
- π‘οΈ Plain Text Knowledge Base - Simple text format for easy knowledge base maintenance
- Python 3.8+
- Node.js 16+
- Ollama - Local AI service
# Clone and setup everything automatically
./setup.sh
# Start the system
./start.shAccess: http://localhost:3000
See TECHNICAL.md for detailed installation instructions.
- Launch System - Run
./start.shto start all services - Open Browser - Navigate to http://localhost:3000
- Enter Email - System automatically loads your conversation history
- Choose Session - Select existing session or start a new conversation
- Knowledge Base Search - System automatically searches 70+ automotive Q&A pairs
- Direct Answers - Get instant responses for common questions about car buying, selling, insurance, maintenance, and electric vehicles
- Context Awareness - AI remembers conversation history and provides relevant follow-up responses
When your question is unclear, the system provides:
- First Round - AI asks clarifying questions to understand your need
- Second Round - Provides more specific guidance based on your response
- Third Round - Offers final assistance attempt with actionable choices
After 3 rounds of unclear communication:
- Create Ticket Button - Escalates to human support with full conversation context
- End Chat Button - Gracefully closes conversation
- Automatic Detection - System can also auto-create tickets for complex issues
- Email-Based - All conversations linked to your email address
- Session History - View and continue previous conversations
- Read-Only Mode - Ended sessions display conversation but prevent new messages
- Status Indicators - Clear visual feedback for session state (active, ended, ticket created)
- Session List - See all your previous conversations with timestamps
- Message Count - Quick overview of conversation length
- Last Message Preview - See the most recent message in each session
- Ticket Status - Visual indicators when support tickets have been created
The system includes comprehensive automotive knowledge covering:
- Car Buying - New vs used, financing, negotiation, documentation
- Car Selling - Timing, valuation, preparation, avoiding scams
- Insurance - Coverage types, choosing providers, claims process
- Financing - Loan options, credit requirements, refinancing
- Maintenance - Service schedules, finding mechanics, common repairs
- Electric Vehicles - Charging, range, incentives, maintenance differences
- Safety & Technology - ADAS features, recalls, reliability research
- Practical Tips - Test driving, negotiations, paperwork, budgeting
New Car Buyer:
- "Should I buy new or used?" β Gets comprehensive comparison
- "What documents do I need?" β Receives complete checklist
- "How do I negotiate price?" β Gets step-by-step strategy
Car Maintenance:
- "When should I change my oil?" β Gets specific mileage recommendations
- "My brakes are squealing" β Gets troubleshooting guidance and safety advice
- "How do I find a good mechanic?" β Receives verification tips and questions to ask
Electric Vehicle Interest:
- "Are EVs worth buying now?" β Gets decision framework based on driving patterns
- "How much does charging cost?" β Receives cost breakdown and calculators
- "Can I install home charging?" β Gets installation guidance and cost estimates
- Direct Answers - Knowledge base search for common questions
- Guided Assistance - 3-round help for unclear requests
- Smart Escalation - Automatic ticket creation for complex issues
After 3 unclear messages, users get clickable options:
- Create Ticket - Human agent escalation
- End Chat - Close conversation gracefully
# Start system
./start.sh
# Stop all services
./stop.sh
# Run tests
python tests/run_all.py- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- API Docs: http://localhost:8000/docs
POST /chat- Send chat message and get AI responseGET /chat/history/{session_id}- Get chat history for a sessionGET /sessions/{email}- Get all sessions for a user email
GET /tickets- Get all support ticketsGET /tickets/{ticket_id}- Get specific ticket detailsPUT /tickets/{ticket_id}/status- Update ticket status
GET /knowledge-base- Get all Q&A pairs from knowledge baseGET /config/knowledge-bases- List available knowledge basesPOST /config/switch-kb/{kb_name}- Switch to different knowledge base
GET /config/status- Get system configuration statusGET /config/ai-status- Get AI service statusPOST /config/reload- Reload all configurations
GET /debug/db-info- Database connection informationGET /debug/raw-sessions/{email}- Raw session data for debugging
FAQ-system/
βββ setup.sh # One-click setup script
βββ start.sh # Service startup script
βββ frontend/ # React.js frontend application
β βββ src/
β β βββ components/ # React components
β β β βββ ChatInterface.tsx
β β β βββ MessageBubble.tsx
β β β βββ SessionHistory.tsx
β β β βββ UserEmailForm.tsx
β β βββ services/ # API service layer
β β βββ types/ # TypeScript type definitions
β β βββ App.tsx # Main application component
β βββ package.json # Dependencies and scripts
β βββ public/ # Static assets
βββ server/ # FastAPI backend application
β βββ app/ # Application code
β β βββ main.py # FastAPI application and routes
β β βββ models.py # SQLAlchemy database models
β β βββ schemas.py # Pydantic request/response schemas
β β βββ database.py # Database configuration
β β βββ ai_service.py # AI conversation logic
β β βββ knowledge_base_service.py # Knowledge base search
β β βββ config_loader.py # Configuration management
β βββ config/ # Configuration files
β β βββ ai_prompts_config.yaml # AI prompts and responses
β β βββ knowledge_base_config.yaml # Knowledge base settings
β β βββ knowledge_bases/ # Knowledge base files
β β βββ automotive_en.txt # Automotive Q&A content
β βββ requirements.txt # Python dependencies
β βββ .env # Environment variables
β βββ run.py # Application entry point
βββ tests/ # Test suite
βββ faq_system.db # SQLite database file
βββ README.md # This documentation
βββ TECHNICAL.md # Detailed technical documentation
- TECHNICAL.md - Comprehensive technical guide
- tests/README.md - Testing documentation
- API Docs - http://localhost:8000/docs (when running)
- Frontend: React 18 + TypeScript + Ant Design 5.x + React Router
- Backend: FastAPI + SQLAlchemy (Async) + SQLite + Pydantic
- AI Service: Ollama + DeepSeek-R1:1.5b model with fallback responses
- Knowledge Base: TF-IDF vectorization + Cosine similarity matching + Plain text format
- Session Management: Email-based persistent sessions with SQLite storage
- Configuration: YAML-based configuration with hot reloading
- Development: Python 3.8+ + Node.js 16+ + TypeScript + ESLint
AI not responding?
# Check Ollama
ollama serve
ollama pull deepseek-r1:1.5bServices not starting?
# Check ports
lsof -i :3000,8000,11434
# Restart everything
./stop.sh && ./start.shNeed help? See TECHNICAL.md for detailed troubleshooting.
Built for intelligent customer service automation