A dual-mode AI assistant powered by OpenRouter's free models (no API key needed!) that acts as:
- Pre-Purchase: Consultative salesperson helping customers find the right product
- Post-Purchase: Technical support engineer for troubleshooting and guidance
# Backend
cd backend
echo AI_PROVIDER=openrouter > .env
pip install -r requirements.txt
python main.py
# Frontend
cd frontend
npm run devOpen http://localhost:5173 - That's it! Works completely free without any API keys.
✨ Dual Mode Operation
- PRE_PURCHASE: Product recommendations, room analysis, color matching
- POST_PURCHASE: Troubleshooting, error codes, installation help, maintenance tips
🎨 Room Image Analysis
- Upload room photos for placement recommendations
- Color matching with available product variants
- Space assessment and fit validation
- Safety and ventilation considerations
🤖 Intelligent Agent
- Powered by OpenRouter free models (Mistral 7B + Qwen2 VL + Llama 3.1)
- Alternative: Google Gemini support included
- Honest product recommendations (never hallucinates specs)
- Safety-first approach (warns when professional help needed)
- Conversation memory for context-aware responses
📦 Product Catalog
- Washing Machines
- Refrigerators
- Headphones
- EV Batteries
- (Easily extensible)
Backend:
- FastAPI (Python)
- OpenRouter API (free tier - Mistral, Qwen, Llama models)
- Alternative: Google Generative AI (Gemini)
- httpx (HTTP client)
- Pillow (image processing)
- Pydantic (data validation)
Frontend:
- React + Vite
- Axios (API calls)
- Lucide React (icons)
- Premium glassmorphism design
- Python 3.9+
- Node.js 18+
- No API key required! (OpenRouter free tier)
- Optional: Google API Key for Gemini (Get it here)
- Navigate to backend directory:
cd backend- Create virtual environment:
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux- Install dependencies:
pip install -r requirements.txt- Create
.envfile:
cp .env.example .env- Edit
.env- No API key needed for OpenRouter!
AI_PROVIDER=openrouter
MODE=PRE_PURCHASE
BRAND_NAME=TechHome
Optional: For Gemini instead:
AI_PROVIDER=gemini
GOOGLE_API_KEY=your_actual_api_key_here
- Run the backend:
python main.pyBackend will be available at http://localhost:8000
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Run the development server:
npm run devFrontend will be available at http://localhost:5173
POST /chat
{
"message": "I need a washing machine for a family of 4",
"category": "washing_machines"
}POST /analyze-room
Content-Type: multipart/form-data
file: <image>POST /error-code
{
"model_id": "AT-WM-9KG-BLACK",
"error_code": "E01"
}POST /mode
{
"mode": "POST_PURCHASE"
}Replace backend/data/products.json with your actual product catalog. Format:
{
"category_name": [
{
"product_id": "unique_id",
"category": "category_name",
"brand": "Brand Name",
"models": [
{
"model_id": "MODEL-ID",
"color": "Color Name",
"hex_color": "#hexcode",
"dimensions_cm": [height, width, depth],
"price": 999,
"warranty_years": 2,
"features": ["feature1", "feature2"],
"installation": "Installation instructions",
"common_issues": [
{
"error": "E01",
"meaning": "Error meaning",
"fix": "How to fix"
}
]
}
]
}
]
}- Create
Dockerfilein backend directory - Build and deploy:
gcloud run deploy product-agent-api \
--source . \
--platform managed \
--region us-central1 \
--allow-unauthenticated- Update
frontend/src/App.jsxwith your API URL - Deploy:
cd frontend
vercelUser: "I need a washing machine for my laundry room"
Agent: Asks clarifying questions about space, family size, budget
User: Uploads room image
Agent: Analyzes room, recommends best size and color variant
User: "My fridge is showing error E01"
Agent: Looks up error code, provides step-by-step fix
User: "How do I clean the filter?"
Agent: Provides maintenance instructions
The agent automatically identifies dangerous operations and warns users:
- High voltage work → "This requires a certified technician"
- Gas connections → Refuses to provide guidance
- Internal electronics → Recommends professional service
MIT License - feel free to use for your products!
For issues or questions, please open a GitHub issue or contact support.