π€ AI-powered TP-Link product recommendation and comparison system with RAG (Retrieval-Augmented Generation) technology.
- π― 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
- Node.js 16+
- OpenAI API Key
- npm or yarn
-
Clone the repository
git clone <repository-url> cd WebAI
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env and add your OpenAI API key -
Start the application
npm start
-
Access the application
- Web Interface: http://localhost:3001
- API Health Check: http://localhost:3001/api/health
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
npm run devNODE_ENV=production npm start# Single instance
npm run pm2:start
# Cluster mode
pm2 start ecosystem.config.js --only tp-link-assistant# Build and run
npm run docker:build
npm run docker:run
# Or use Docker Compose
docker-compose up -dchmod +x deploy.sh
./deploy.shPOST /api/recommend
Content-Type: application/json
{
"query": "I need a router for gaming"
}POST /api/compare
Content-Type: application/json
{
"products": ["BE65", "BE95"]
}POST /api/spec
Content-Type: application/json
{
"model": "Deco BE65",
"spec": "speed"
}POST /api/query
Content-Type: application/json
{
"message": "What's the best mesh system for large homes?"
}{
"success": true,
"data": {
"intent": "product_recommendation",
"result": [...],
"nextQuestions": [...]
},
"timestamp": "2024-01-01T00:00:00.000Z"
}- 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
- User query β Intent classification
- RAG retrieval β Relevant product matching
- OpenAI processing β Personalized recommendations
- Response formatting β UI display
- Next questions β Intelligent suggestions
# Required
OPENAI_API_KEY=your_openai_api_key
# Optional
PORT=3001
NODE_ENV=development
MAX_REQUESTS_PER_MINUTE=60Edit 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
}
}]
};# Run tests
npm test
# Test API endpoints
curl http://localhost:3001/api/health- Development: Console output
- Production:
./logs/directory - PM2:
pm2 logs - Docker:
docker logs tp-link-assistant
curl http://localhost:3001/api/health- Environment variable protection for API keys
- CORS enabled for cross-origin requests
- Input validation and sanitization
- Rate limiting support
- Non-root Docker container execution
- RAG System: Semantic product matching and retrieval
- Caching: Intelligent response caching
- Optimization: Compressed assets and efficient queries
- Scalability: PM2 cluster mode and Docker support
- 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
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
ISC License - see LICENSE file for details
- 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 π