Spaces:
Runtime error
Runtime error
File size: 3,187 Bytes
9d79680 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | # π AJ + ngrok - START HERE
## β‘ Quick Start (3 Simple Steps)
### Step 1: Start Everything
**Double-click:** `QUICK_START.bat`
You'll see two windows open in the background:
- Flask API (localhost:5000)
- ngrok tunnel
### Step 2: Get Your Public URL
Open your browser and go to:
```
http://localhost:4040
```
You'll see a page showing your PUBLIC ngrok URL like:
```
https://1a2b3c4d5e6f-abcd.ngrok.io
```
**Copy this URL!**
### Step 3: Connect & Chat
**Open `index.html` in your browser**
1. Paste your ngrok URL into the **"π‘ ngrok API URL Configuration"** field
2. Click **"Save URL"**
3. Wait for **"β
Connected!"** status
4. Type your message and press Send!
---
## β
Checklist
- [ ] Running `QUICK_START.bat`
- [ ] API and ngrok are running (check with Task Manager)
- [ ] Got ngrok URL from `http://localhost:4040`
- [ ] Opened `index.html` in browser
- [ ] Pasted ngrok URL and clicked Save
- [ ] Chatting with AJ!
---
## π― What's Running
| Service | URL | Purpose |
|---------|-----|---------|
| **Flask API** | `http://localhost:5000` | Local AI API (aj-mini) |
| **ngrok Dashboard** | `http://localhost:4040` | View your public URL |
| **Web Interface** | Open `index.html` | Chat with AJ |
| **Public URL** | `https://xxxxx.ngrok.io` | Your public API endpoint |
---
## π Example Chat
**You:** "Hello, how are you?"
**AJ:** (Uses aj-mini model to reply perfectly with context-aware response)
---
## β οΈ Important Notes
- Your **PC must stay ON** for the API to be accessible
- Your **ngrok URL changes** when you restart services (this is normal)
- The **public URL expires** after 7 days if unused (free tier)
- **CORS is enabled** - works with any frontend
---
## π§ Troubleshooting
**"Connection failed" in web interface?**
- Check ngrok URL is correct (from `http://localhost:4040`)
- Make sure you clicked "Save URL"
- Verify both services are running
**"API not responding" error?**
- Check if Flask is running (Task Manager β search "python")
- Restart `QUICK_START.bat`
**Web page won't load?**
- Right-click `index.html` β Open with Browser
- Or drag-drop into browser
- Try clearing browser cache (Ctrl+Shift+Delete)
**ngrok URL keeps changing?**
- This is normal for free tier
- Get the new URL from `http://localhost:4040` each time
---
## π How It Works
```
Your Questions
β
index.html (Web UI)
β
ngrok tunnel (HTTPS)
β
Flask API (localhost:5000)
β
Ollama + aj-mini Model
β
Perfect AI Response β¨
```
---
## π Files Explained
| File | Purpose |
|------|---------|
| `QUICK_START.bat` | Launches everything (use this!) |
| `index.html` | Web interface for chatting |
| `api_server.py` | Flask API backend |
| `start_ngrok.ps1` | PowerShell launcher (advanced) |
| `NGROK-SETUP.md` | Detailed setup guide |
---
## π When You're Ready for Production
Instead of ngrok (which requires your PC to stay on), deploy to:
- **Render.com** - Connect to a proper AI API service (Groq, HuggingFace, etc.)
- **Railway.app** - Similar to Render
- See `DEPLOYMENT-GUIDE.md` for full production options
---
**Questions?** Check the other .md files for detailed guides!
|