# Quick Setup Guide - AIPlot Web Interface Get your web interface running in **5 minutes**! ⚡ --- ## 🎯 Prerequisites Before you start, make sure you have: - ✅ n8n installed and running - ✅ `aiplot_claude_workflow_fixed.json` imported to n8n - ✅ Workflow activated in n8n - ✅ Webhook URL from n8n (looks like: `http://localhost:5678/webhook/aiplot-generate`) --- ## 📋 Step-by-Step Setup ### Step 1: Get Your Webhook URL (2 minutes) 1. **Open n8n** in your browser 2. **Find the AIPlot workflow** (click on it) 3. **Click the "Webhook" node** (first node in workflow) 4. **Copy the URL** shown: - For testing: Use "Test URL" - For production: Use "Production URL" **Example URL:** ``` http://localhost:5678/webhook/aiplot-generate ``` 💡 **Tip:** Make sure the workflow is **activated** (toggle switch should be green)! --- ### Step 2: Open the Web Interface (1 minute) **Option A: Direct File (Easiest)** 1. Navigate to the `web` folder 2. Double-click `index.html` 3. It opens in your browser! **Option B: Local Server (Better)** In terminal/command prompt: ```bash cd n8nplot/web python -m http.server 8080 ``` Then open: `http://localhost:8080` --- ### Step 3: Configure Webhook URL (30 seconds) 1. Look for the **Configuration** section at the top 2. Paste your webhook URL in the input field 3. The URL is **automatically saved** for next time! --- ### Step 4: Generate Your First Scene (1 minute) **Quick Test:** 1. Click on **"🏝️ Tropical Paradise"** example chip 2. Click **"Generate Unity Scene"** button 3. Wait 3-5 seconds ⏳ 4. See your results! 🎉 **Or Write Your Own:** Type something like: ``` Create a peaceful forest with 10 pine trees and rocks ``` Press **Ctrl+Enter** or click the generate button. --- ## ✅ Success Checklist After generation, you should see: - ✅ **Scene Details Card** with environment and mood - ✅ **Statistics** showing number of objects - ✅ **Download Button** to get XML file - ✅ **Green success message** at top **Example Output:** ``` ✅ Scene generated successfully! 🌍 Environment: tropical 💫 Mood: peaceful 🎯 Objects: 18 📄 File Size: 2.4 KB ``` --- ## 🎮 Using the Generated Scene 1. **Click "Download XML File"** button 2. **Save the `.txt` file** to your computer 3. **Open Unity 3D** 4. **Import the scene** using your Unity import tool 5. **Your scene loads** with all objects placed! --- ## 🔧 Common Issues & Fixes ### Issue 1: "Failed to generate scene: Network error" **Problem:** Cannot connect to n8n **Solutions:** ```bash # Check if n8n is running # Open: http://localhost:5678 # Make sure workflow is activated # Toggle switch should be green # Verify webhook URL is correct # Copy it again from the Webhook node ``` --- ### Issue 2: "CORS error" in browser console **Problem:** Browser blocking cross-origin requests **Quick Fix for Development:** 1. Open n8n workflow 2. Find "Respond to Webhook" node (last node) 3. Click on it 4. Add this to "Response Headers": ```json { "Access-Control-Allow-Origin": "*" } ``` 5. Save and test again **Better Fix:** Run web interface and n8n on same domain or use a local server. --- ### Issue 3: Page loads but looks broken **Problem:** CSS file not loading **Fix:** ```bash # Make sure all files are in same folder: web/ ├── index.html ├── styles.css ← Check this exists └── script.js ← And this # Clear browser cache # Press: Ctrl + Shift + R (Windows) # Or: Cmd + Shift + R (Mac) ``` --- ### Issue 4: Button doesn't do anything **Problem:** JavaScript not running **Check:** 1. Open browser console (Press F12) 2. Look for red errors 3. Most common: Webhook URL is wrong 4. Try with "Test URL" instead of "Production URL" **Debug:** ```bash # Test webhook directly with curl curl -X POST http://localhost:5678/webhook/aiplot-generate \ -H "Content-Type: application/json" \ -d '{"prompt": "test scene"}' # Should return JSON with XML content ``` --- ## 🎨 Customization Quick Tips ### Change Default Webhook URL Edit `index.html`, find this line (~line 43): ```html ``` Change to your URL: ```html ``` ### Add Your Own Examples Edit `index.html`, find `