- Add verification of IA connectivity after deployment
- Show helpful troubleshooting message if Ollama is not accessible
- Document required UniFi USG Pro 4 configuration
- Add GIT_REPO variable for future use
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add map to detect POST requests to /auth/login
- Redirect POST /auth/login to CMS service (port 3001)
- Keep GET /auth/login on frontend (port 3000)
AI Status:
- Ollama server (t-800.norteamericano.cl:11434) not accessible from AWS EC2
- Connection timeout - need to open port 11434 or use public IP
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Remove complex location blocks from nginx
- Let Next.js rewrites handle API routing to CMS
- Keep only basic proxy configuration
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add location blocks for API endpoints to redirect to CMS (port 3001)
- Keep frontend pages on Next.js (port 3000)
- Handle /auth/login specially: GET->frontend, POST->CMS API
- Add maps for detecting API routes
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add studio-api-location.conf to redirect API routes to CMS service (port 3001)
- Routes /auth, /courses, /lessons, etc. now go to CMS instead of frontend
- Mount location config in nginx-proxy vhost.d directory
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add NEXT_PUBLIC_CMS_API_URL and NEXT_PUBLIC_LMS_API_URL to .env
- URLs use domains without ports (nginx proxy handles routing)
- Add validation to detect URLs with ports that cause CORS errors
- Show warnings if URLs have incorrect port configuration
- Verify environment variables in both .env and containers
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add option to keep or reset database (preserves data by default)
- Add option to preserve existing SSL certificates
- Show warnings before database reset with confirmation
- Skip certificate regeneration when preserve SSL is selected
- Update deployment summary with new options
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add all variables from current .env file
- Include comprehensive comments and descriptions
- Add sample values for development/production
- Organize by category for clarity
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Move NEXT_PUBLIC_CMS_API_URL and NEXT_PUBLIC_LMS_API_URL to .env
- Update docker-compose.yml to use ${VAR} syntax instead of hardcoded URLs
- Add default HTTPS URLs in .env.example for production
- Keeps install.sh with localhost defaults for development
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Change NEXT_PUBLIC_CMS_API_URL from http to https
- Change NEXT_PUBLIC_LMS_API_URL from http to https
- Fix Mixed Content error when serving over HTTPS
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Database:
- Create token_limit_alerts table to track alert history
- Add send_token_limit_notification() function
- Add check_token_limit_trigger() function
- Create AFTER INSERT trigger on ai_usage_logs
Features:
- Automatic notifications at 80%, 90%, and 100% thresholds
- One alert per threshold per month (no spam)
- Notification stored in notifications table
- Alert details logged in token_limit_alerts table
Notification Messages:
- 80%: Warning to monitor usage
- 90%: Strong warning to reduce IA usage
- 100%: Limit exceeded notification
Next: Add enforce automatic checks in AI handlers
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Token Usage Dashboard (/admin/token-usage):
- Add Monthly Limit column with edit functionality
- Add % Used column with progress bars
- Color-coded alerts (green/yellow/orange/red)
- Real-time limit updates via API
- Alert banners for users >80% and >100%
User Management (/admin/users):
- Add Token Limit column
- Show percentage used with progress indicator
- Color-coded badges for usage levels
Admin Dashboard (/admin):
- Add AI Token Usage card
- Display total tokens, requests, and cost
- Link to detailed token usage page
All changes are fully responsive and dark-mode compatible.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add token_limits module with check_ai_token_limit function
- Database: monthly_token_limit, token_limit_reset_day columns
- SQL functions: check_token_limit, get_user_usage_stats
- API endpoints for admin user token management
- Documentation: TOKEN_LIMITS_GUIDE.md
Phase 2 will add automatic enforcement in AI handlers
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Database:
- Add monthly_token_limit and token_limit_reset_day to users table
- Create ai_usage_monthly view for current month usage
- Add check_token_limit() function to verify available tokens
- Add get_user_usage_stats() function for historical usage
API Endpoints:
- PUT /admin/users/{user_id}/token-limit - Set monthly limit
- GET /admin/users/{user_id}/token-usage - Get user's current usage
- GET /admin/users/{user_id}/token-limit/check - Check if user has tokens
Features:
- Default limit: 100,000 tokens/month
- Reset day: 1st of month (configurable 1-28)
- Limit of 0 = unlimited tokens
- Enforce limits at API level (check before AI requests)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- QuizPlayer: Fixed method name from submitLessonScore to submitScore
- Lesson page: Fixed method name and parameter order
- submitScore signature: submitScore(userId, courseId, lessonId, score, metadata)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Changed from lesson.metadata.blocks to lesson.content_blocks
- Backend stores blocks in content_blocks column, not metadata
- Fixes issue where only first block was showing in lessons with multiple exercises
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added HEAD method to CORS allowed methods
- Added Range header support for video streaming
- Exposed Content-Range and Accept-Ranges headers
- Required for proper video playback from Experience (port 3003) to CMS (port 3001)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>