Skip to content

KevinWangQQ/WebAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TP-Link Product Assistant v2.0

πŸ€– AI-powered TP-Link product recommendation and comparison system with RAG (Retrieval-Augmented Generation) technology.

✨ Features

  • 🎯 Smart Product Recommendations: AI-powered suggestions based on your specific needs
  • πŸ“Š Intelligent Product Comparison: Side-by-side comparison of technical specifications
  • πŸ“‹ Detailed Specifications: Comprehensive product information and technical specs
  • πŸ”§ Feature Analysis: In-depth feature exploration and capability assessment
  • πŸ’‘ Next Question Suggestions: Intelligent follow-up question recommendations
  • πŸ“± Responsive Design: Modern light theme optimized for desktop and mobile
  • 🌐 Multi-language Support: English and Chinese language support
  • πŸ” Advanced RAG System: Enhanced product search and retrieval

πŸš€ Quick Start

Prerequisites

  • Node.js 16+
  • OpenAI API Key
  • npm or yarn

Installation

  1. Clone the repository

    git clone <repository-url>
    cd WebAI
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env
    # Edit .env and add your OpenAI API key
  4. Start the application

    npm start
  5. Access the application

πŸ“¦ Product Database

The system includes comprehensive data for 6 product categories:

  • Deco Mesh Systems: BE65, BE95, X50
  • WiFi Routers: AX73, AX55, BE800
  • Range Extenders: RE705X, RE200
  • Access Points: EAP660 HD
  • Network Switches: TL-SG1005P
  • Powerline Adapters: TL-PA7017

πŸ› οΈ Deployment Options

1. Local Development

npm run dev

2. Production Server

NODE_ENV=production npm start

3. PM2 Process Manager

# Single instance
npm run pm2:start

# Cluster mode
pm2 start ecosystem.config.js --only tp-link-assistant

4. Docker

# Build and run
npm run docker:build
npm run docker:run

# Or use Docker Compose
docker-compose up -d

5. Automated Deployment

chmod +x deploy.sh
./deploy.sh

πŸ“– API Documentation

Core Endpoints

Product Recommendations

POST /api/recommend
Content-Type: application/json

{
  "query": "I need a router for gaming"
}

Product Comparison

POST /api/compare
Content-Type: application/json

{
  "products": ["BE65", "BE95"]
}

Specifications Query

POST /api/spec
Content-Type: application/json

{
  "model": "Deco BE65",
  "spec": "speed"
}

General Query

POST /api/query
Content-Type: application/json

{
  "message": "What's the best mesh system for large homes?"
}

Response Format

{
  "success": true,
  "data": {
    "intent": "product_recommendation",
    "result": [...],
    "nextQuestions": [...]
  },
  "timestamp": "2024-01-01T00:00:00.000Z"
}

πŸ—οΈ Architecture

Core Components

  • RAG Agent (rag-agent.js): Advanced retrieval and generation system
  • Product Index: Semantic search capabilities for product matching
  • Intent Classification: Smart query understanding and routing
  • Response Generation: Context-aware AI responses with OpenAI GPT-4
  • UI Framework: Modern responsive design with CSS custom properties

Data Flow

  1. User query β†’ Intent classification
  2. RAG retrieval β†’ Relevant product matching
  3. OpenAI processing β†’ Personalized recommendations
  4. Response formatting β†’ UI display
  5. Next questions β†’ Intelligent suggestions

πŸ”§ Configuration

Environment Variables

# Required
OPENAI_API_KEY=your_openai_api_key

# Optional
PORT=3001
NODE_ENV=development
MAX_REQUESTS_PER_MINUTE=60

PM2 Configuration

Edit ecosystem.config.js for production deployment settings:

module.exports = {
  apps: [{
    name: 'tp-link-assistant',
    script: 'server.js',
    instances: 'max',
    env_production: {
      NODE_ENV: 'production',
      PORT: 8080
    }
  }]
};

πŸ§ͺ Testing

# Run tests
npm test

# Test API endpoints
curl http://localhost:3001/api/health

πŸ“Š Monitoring

Logs

  • Development: Console output
  • Production: ./logs/ directory
  • PM2: pm2 logs
  • Docker: docker logs tp-link-assistant

Health Check

curl http://localhost:3001/api/health

πŸ”’ Security Features

  • Environment variable protection for API keys
  • CORS enabled for cross-origin requests
  • Input validation and sanitization
  • Rate limiting support
  • Non-root Docker container execution

πŸš€ Performance

  • RAG System: Semantic product matching and retrieval
  • Caching: Intelligent response caching
  • Optimization: Compressed assets and efficient queries
  • Scalability: PM2 cluster mode and Docker support

πŸ“± UI Features

  • Modern Design: Light theme with CSS custom properties
  • Responsive Layout: Mobile-first responsive design
  • Real-time Suggestions: Dynamic next question recommendations
  • Interactive Elements: Hover effects and smooth animations
  • Accessibility: Semantic HTML and keyboard navigation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. Submit a pull request

πŸ“„ License

ISC License - see LICENSE file for details

πŸ†˜ Support

  • Documentation: Check this README and inline code comments
  • Issues: Report bugs and feature requests
  • API Questions: Test endpoints with provided examples

TP-Link Product Assistant v2.0 - Powered by OpenAI GPT-4 and RAG Technology πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors