Commit Graph

173 Commits

Author SHA1 Message Date
Nurfog 2d54d6abfc feat: Añadir scripts para generar y sincronizar archivos .env, actualizar configuraciones de Docker y mejorar el despliegue en producción 2026-03-31 10:10:44 -03:00
Nurfog f6b6f84427 feat: Añadir configuración de Nginx para API de OpenCCB y corregir URLs de producción 2026-03-30 13:32:51 -03:00
Nurfog e66c5df695 feat: Add Ollama connectivity check to deploy script
- 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>
2026-03-28 09:53:13 -03:00
Nurfog 4df2cd5538 docs: Add network and firewall configuration documentation
- Add CONFIGURACION_RED.md with complete network setup guide
- Document UniFi USG Pro 4 port forwarding and firewall rules
- Add AWS EC2 security group configuration
- Add connectivity verification commands
- Add troubleshooting checklist

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-28 09:21:31 -03:00
Nurfog 8b74ebafa5 fix: Update permissions and API routing for CMS integration 2026-03-28 08:55:35 -03:00
Nurfog a3f3f8f3c2 fix: Nginx POST /auth/login redirect to CMS
- 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>
2026-03-27 15:03:28 -03:00
Nurfog e1f0d9ceb7 fix: Simplify nginx config - let Next.js handle API rewrites
- 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>
2026-03-27 14:12:12 -03:00
Nurfog 422a143685 fix: Nginx proxy configuration for CMS API routes
- 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>
2026-03-27 14:04:11 -03:00
Nurfog ff0850b87e fix: Add nginx proxy rules for CMS API routes
- 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>
2026-03-27 13:21:44 -03:00
Nurfog de85e82554 fix: Configure correct API URLs without ports in .env
- 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>
2026-03-27 12:17:33 -03:00
Nurfog 76c9a4a2d4 feat: Add database reset and SSL preserve options to deploy script
- 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>
2026-03-27 11:12:12 -03:00
Nurfog 1d419ee9f3 docs: Update .env.example with all environment variables
- 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>
2026-03-27 10:52:40 -03:00
Nurfog a203a82038 refactor: Use environment variables for API URLs in docker-compose
- 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>
2026-03-27 10:50:14 -03:00
Nurfog 3ef1a73b95 fix: Update student portal link to use HTTPS
- Change hardcoded URL from http to https in login page footer

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-27 10:47:43 -03:00
Nurfog b3f03bb2a7 fix: Use HTTPS URLs for API endpoints in production
- 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>
2026-03-27 09:23:16 -03:00
Nurfog e4866c6dee feat: SAM integration, deployment scripts, and audio response enhancements
- Add SAM (Sistema de Administración Académica) integration with sync endpoints
- Add deployment automation (deploy.sh, remote-setup.sh, setup-nginx-ssl.sh)
- Add nginx proxy configuration for SSL with Let's Encrypt
- Add audio response support for student lessons (migrations, handlers)
- Add audio evaluations admin page
- Update CORS to support wildcard subdomains for norteamericano.cl
- Add comprehensive deployment documentation (DESPLIEGUE.md, ManualDeConfiguracion.md)
- Update docker-compose.yml with nginx-proxy and acme-companion services
- Remove outdated documentation files

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-27 09:20:23 -03:00
Nurfog 995065df4f fix: Use correct token key (studio_token) in admin pages
- Fix localStorage token key from 'token' to 'studio_token'
- Add debug logging for token authentication
- Add automatic redirect to login on 401
- Add error messages for missing/expired tokens

Affected pages:
- /admin/token-usage
- /admin/users
- /admin

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 17:32:08 -03:00
Nurfog dce68d76df docs: Token Limits complete summary (100% implementation)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 17:23:52 -03:00
Nurfog 6ef2860b26 feat: Enforce Automatic Token Limits in AI Handlers
CMS Service:
- generate_quiz: Check 2000 tokens limit
- generate_course: Check 5000 tokens limit
- generate_hotspots: Check 2000 tokens limit
- generate_role_play: Check 2500 tokens limit
- summarize_lesson: Check 1500 tokens limit

LMS Service:
- chat_with_tutor: Check 1000 tokens limit
- evaluate_audio_response: Check 1500 tokens limit

Behavior:
- Returns HTTP 429 Too Many Requests when limit exceeded
- Error message indicates monthly limit exceeded
- Users must contact admin for limit increase
- Works with automatic alert system (Phase 3)

Total Functions Protected: 7

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 17:18:04 -03:00
Nurfog 173ddfae53 docs: Token Limits final implementation guide
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 17:10:11 -03:00
Nurfog 3edc90b362 feat: Token Limit Alerts System (Phase 3)
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>
2026-03-23 17:08:01 -03:00
Nurfog f12677729b docs: Token Limits UI implementation guide
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 16:45:31 -03:00
Nurfog 8d82685cb4 feat: Token Limits UI - Phase 2 (Dashboard + User Management)
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>
2026-03-23 16:44:34 -03:00
Nurfog 83e3375ecf docs: Token limits implementation status
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 16:22:55 -03:00
Nurfog 585e436538 feat: Token limits - Phase 1 (Database + API)
- 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>
2026-03-23 16:22:28 -03:00
Nurfog 84091ed7b0 docs: Token limits user guide
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 16:11:15 -03:00
Nurfog 9e57756528 feat: Monthly token limits per user
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>
2026-03-23 16:10:27 -03:00
Nurfog ef213a61a0 fix: Quiz score submission - use correct submitScore method
- 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>
2026-03-23 13:29:46 -03:00
Nurfog 5185c07092 fix: Experience lesson blocks rendering from content_blocks field
- 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>
2026-03-23 13:16:18 -03:00
Nurfog d5679c05e8 fix: CORS headers for video/audio assets streaming
- 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>
2026-03-23 13:07:37 -03:00
Nurfog 2ff06ee7ae feat: i18n full support, responsive UI, multi-model AI config, and bug fixes
Major Features:
- Internationalization (i18n) with auto-detection for ES/EN/PT
- Mobile-first responsive design for Studio and Experience
- Multi-model AI configuration (llama3.2:3b, qwen3.5:9b, gpt-oss:latest)
- Course language configuration (auto-detect or fixed per course)

Backend Changes:
- shared/common: ModelType enum for intelligent model selection
- LMS: log_ai_usage function migration (fix chat tutor 500 error)
- LMS/CMS: course language config fields (language_setting, fixed_language)
- LMS: /courses/{id}/language-config endpoint for language detection

Frontend Changes:
- Experience: Enhanced i18n with browser language detection
- Experience: Audio recording with HTTPS check and error handling
- Studio: Memory game with unique pair IDs and debug logging
- Studio: Expanded translations (250+ keys for ES, EN, PT)
- Both: Language selector in headers (mobile responsive)

Documentation:
- AI_MODELS_CONFIG.md: Multi-model configuration guide
- RESPONSIVIDAD_GUIA.md: Mobile-first design patterns
- I18N_RESPONSIVIDAD_IMPLEMENTACION.md: Implementation details
- DEBUG_AUDIO_RECORDING.md: Audio troubleshooting guide
- DEBUG_MEMORY_GAME.md: Memory game debugging steps

Bug Fixes:
- Fix chat tutor 500 error (missing log_ai_usage function)
- Fix audio recording (HTTPS check, browser compatibility)
- Fix memory game pair IDs (unique ID generation)
- Fix HotspotBlock TypeScript errors

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-23 12:24:22 -03:00
Nurfog 0598fc4865 feat: Fix tokens Revenue stream 2026-03-19 14:54:31 -03:00
Nurfog 686eb377f0 feat: activate AI usage 2026-03-19 11:21:59 -03:00
Nurfog a220e9742f feat:fix data importation 2026-03-19 09:33:33 -03:00
Nurfog 42e0934a0e feat: fix importation from remote DB 2026-03-18 17:59:54 -03:00
Nurfog 64d3d5be91 feat: implementing embedding AI 2026-03-18 17:15:39 -03:00
Nurfog e8cdf61468 feath: save questions generated with AI 2026-03-17 17:59:55 -03:00
Nurfog 55f9a3196e feat: fix AI for generation questions with RAG 2026-03-17 17:44:42 -03:00
Nurfog 31939e31ad feat: fix frontend and activate imports 2026-03-17 13:53:12 -03:00
Nurfog be699ad6ab feat: token count implement 2026-03-17 12:07:56 -03:00
Nurfog 41279585f6 feat: creacion de plantillas para pruebas, prototipo 2026-03-16 12:28:29 -03:00
Nurfog 7409f8bfda feat: fix models.rs 2026-03-16 09:58:00 -03:00
Nurfog 3167723a89 feat: Update default admin credentials and organization branding, refactor admin creation in install script to direct database insertion, disable rate limiting, and update documentation. 2026-03-13 13:24:06 -03:00
Nurfog c49a49dc19 feat: Add comprehensive project context documentation and refactor CMS service to include HTTP tracing and streamline CORS configuration. 2026-03-13 12:43:32 -03:00
Nurfog 3bfff51a69 asdf 2026-03-13 12:07:14 -03:00
Nurfog 15ecc4e3b2 feat: Update database port to 5433, refine database creation and migration scripts, and add explicit CORS OPTIONS handling to CMS service routes. 2026-03-13 10:46:54 -03:00
Nurfog f9f1238310 feat: Implement health checks, rate limiting, and security headers for services, update Node.js versions, and add Prettier configuration for frontend. 2026-03-12 17:09:05 -03:00
Nurfog 5e3db5f2a2 feat: Add "library" and "settings" translations to English, Spanish, and Portuguese locale files. 2026-03-10 10:11:34 -03:00
Nurfog e9e173a5b0 1 2026-03-10 09:36:25 -03:00
Nurfog 2fe6dcea59 feat: Implement default branding synchronization and improve API header handling. 2026-03-09 17:55:10 -03:00