Spaces:
Sleeping
Sleeping
File size: 4,267 Bytes
964103b | 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | # Vercel Setup - Quick Reference
## π Pre-Deployment Checklist
- [ ] GitHub repository with code
- [ ] Google Gemini API key ([Get one](https://makersuite.google.com/app/apikey))
- [ ] Vercel account ([Sign up free](https://vercel.com/signup))
## π Deployment Steps
### 1. Import Project to Vercel
```
1. Go to vercel.com
2. Click "Add New..." β "Project"
3. Select "Import Git Repository"
4. Choose your GitHub repository
5. Vercel auto-detects configuration from vercel.json
```
### 2. Configure Environment Variables
Add these in Vercel Dashboard β Settings β Environment Variables:
#### Required
```
GOOGLE_API_KEY=AIza...your-key-here
```
#### Optional (with defaults)
```
EMBEDDING_MODEL=all-MiniLM-L6-v2
RELEVANCE_THRESHOLD=0.5
TOP_K_CHUNKS=3
LLM_MODEL=gemini-1.5-flash
LLM_TEMPERATURE=0.3
```
**Important**: Set for all environments (Production, Preview, Development)
### 3. Deploy
```
1. Click "Deploy"
2. Wait 2-3 minutes
3. Visit your URL: https://your-app.vercel.app
```
## β
Post-Deployment Testing
### Test Questions
**Should Answer:**
```
"How do I create a new project in TaskFlow?"
"How do I add a team member?"
"What are the subscription plans?"
```
**Should Escalate:**
```
"What's the weather today?"
"Tell me a joke"
"How do I cook pasta?"
```
### Verify
- [ ] Frontend loads correctly
- [ ] Can submit questions
- [ ] Answers appear in chat
- [ ] Confidence explanations show
- [ ] Escalations work for out-of-scope questions
## π§ Common Issues
### Build Fails
**Error**: "Module not found"
```bash
# Solution: Ensure requirements.txt includes all dependencies
pip freeze > requirements.txt
git add requirements.txt
git commit -m "Update dependencies"
git push
```
### API Returns 500
**Error**: Function crashes
```bash
# Solution: Check Vercel function logs
1. Go to Vercel Dashboard β Deployments
2. Click on latest deployment
3. View Function Logs
4. Look for Python errors
```
### Frontend Can't Reach API
**Error**: "Failed to fetch"
```bash
# Solution: Test API directly
curl -X POST https://your-app.vercel.app/api/ask \
-H "Content-Type: application/json" \
-d '{"question":"test"}'
# Should return JSON response
```
### Slow Responses
**Issue**: First request takes 5-10 seconds
```
This is normal! First request loads embedding model.
Subsequent requests are fast (1-3 seconds).
```
## π Monitoring
### View Logs
```
Vercel Dashboard β Your Project β Deployments β Function Logs
```
### Key Metrics
- Function execution time: Should be <5s
- Error rate: Should be <5%
- Memory usage: Should be <1GB
### Enable Analytics
```
Vercel Dashboard β Analytics β Enable Web Analytics
```
## π Updating
### Update Code
```bash
git add .
git commit -m "Update feature"
git push
# Vercel auto-deploys
```
### Update Help Articles
```bash
vim data/articles/getting-started.md
git add data/articles/
git commit -m "Update help articles"
git push
# Vector store rebuilds automatically
```
### Update Environment Variables
```
1. Vercel Dashboard β Settings β Environment Variables
2. Edit variable
3. Redeploy (automatic or manual)
```
## π° Cost Tracking
### Free Tier Limits
- 100GB bandwidth/month
- 100 hours function execution/month
- 6,000 function invocations/day
### Monitor Usage
```
Vercel Dashboard β Usage
```
### Expected Usage (100-500 requests/day)
- Function time: ~1-2s per request
- Daily: 100-1000s = 0.03-0.3 hours
- Monthly: 1-9 hours
- **Well within free tier**
## π Getting Help
### Resources
- [Full Deployment Guide](DEPLOYMENT.md)
- [README](README.md)
- [Vercel Docs](https://vercel.com/docs)
- [Vercel Community](https://github.com/vercel/vercel/discussions)
### Support Channels
1. Check function logs in Vercel Dashboard
2. Review [DEPLOYMENT.md](DEPLOYMENT.md) troubleshooting section
3. Open GitHub issue
4. Vercel support (Pro plan)
## π― Next Steps
After successful deployment:
- [ ] Test with various questions
- [ ] Enable Vercel Analytics
- [ ] Set up custom domain (optional)
- [ ] Monitor performance
- [ ] Share with users!
---
**Quick Links:**
- [Vercel Dashboard](https://vercel.com/dashboard)
- [Google AI Studio](https://makersuite.google.com/app/apikey)
- [Full Documentation](DEPLOYMENT.md)
|