English | ไธญๆ
AI-powered tool for generating complete ESL lesson slide decks (HTML + PDF) for 51Talk adult learners in Saudi Arabia. Now with a full web interface.
- Interactive CLI โ Single lesson or full unit generation with AI planning chat
- Web Dashboard โ Browser-based UI with real-time progress, no build step
- Unit Wizard โ 5-step flow: demand input โ AI level analysis โ planning chat โ SSE generation โ result download
- Quick Lesson โ One-page form for fast single-lesson generation
- Settings Panel โ Adjust API key, base URL, temperature, and output toggles from the UI
- Session Resume โ Close browser mid-generation; reopen to auto-recover progress
- Bilingual UI โ English / Arabic language switch on all pages
- AI Level Recommendation โ Natural language input โ CEFR level suggestion
- Dual-layer QA โ Programmatic + AI evaluation with Excel logging
- Python 3.10+
- OpenAI-compatible API key (configured in
config.pyor via web Settings)
# Core dependencies
pip install openai playwright openpyxl
playwright install chromium
# Web interface dependencies
pip install -r requirements-web.txt# Interactive mode
python main.py
# Auto runner (non-interactive, random topic + QA)
python auto_runner.py
# QA only (test existing unit)
python qa_tester.py [unit_folder_path]python api.pyThen open http://localhost:8000 in your browser.
- Dashboard (
/) โ Recent units, quick actions - Unit Wizard (
/wizard.html) โ Full 5-step unit generation - Quick Lesson (
/quick.html) โ Single lesson fast track - Settings โ Click the gear icon on the Dashboard to adjust API config
| Endpoint | Method | Description |
|---|---|---|
/api/analyze-level |
POST | AI recommends CEFR level from natural language description |
/api/unit/plan-chat |
POST | Multi-turn unit planning chat (session-based) |
/api/unit/generate |
POST | SSE stream โ generates full unit with live progress + logs |
/api/lesson/generate |
POST | SSE stream โ generates single lesson |
/api/units |
GET | List all generated units |
/api/settings |
GET / POST | Read / update runtime config (API key, URL, toggles) |
/api/session/{id} |
GET | Check session status for resume |
Full API spec: DOCS/API.md
Provide a blueprint string directly. Output: output/<name>_<level>.json/html/pdf
- Describe teaching needs (AI recommends CEFR level)
- Chat with AI to refine the unit plan
- Click Proceed or type
proceedwhen ready - AI generates 6โ10 lesson outline + each lesson automatically
Picks random level + topic from pool of 75 topics, generates full unit, runs QA automatically.
tp_generator/
โโโ api.py # FastAPI backend (REST + SSE)
โโโ main.py # Interactive CLI entry point
โโโ auto_runner.py # Non-interactive autonomous runner
โโโ config.py # API config, OpenAI client proxy, theme, levels
โโโ content_processor.py # AI orchestration (outline, slides, polish, unit planning)
โโโ slide_renderer.py # HTML rendering (logo embedded as base64) + PDF export
โโโ qa_tester.py # Dual-layer QA (programmatic + AI) + Excel logging
โโโ utils.py # Shared utilities (safe_name, retry, create_unit_dir, generate_lesson)
โโโ i18n.py # Bilingual string loader (EN/AR)
โโโ 51talklogo.png # Logo asset (embedded into HTML/PDF at build time)
โโโ prompts/ # All prompt files (never hardcoded in Python)
โ โโโ common_*.md # Shared prompts (unit, slides, polish, QA, teacher context)
โ โโโ {Level} *.md # Per-level generator, polisher, QA prompts
โโโ l10n/ # UI translations
โ โโโ en.json
โ โโโ ar.json
โโโ frontend/ # Web UI (vanilla HTML + Tailwind CSS)
โ โโโ index.html # Dashboard
โ โโโ wizard.html # 5-step Unit Wizard
โ โโโ quick.html # Quick Single Lesson
โ โโโ i18n.js # Shared i18n engine
โ โโโ components.js # Shared UI components (level selector, file grid, SSE)
โ โโโ 51talklogo.png # Logo
โโโ output/ # All generated output (not version-controlled)
โ โโโ qa_log.xlsx # Cumulative QA log across all runs
โ โโโ _debug/ # Raw AI responses for debugging
โ โโโ Unit_{Level}_{Date}_{Name}/
โ โโโ unit_outline.json
โ โโโ L{N}_{Name}_{Level}.json / .html / .pdf
โ โโโ _qa/ # QA reports per unit
โโโ DOCS/ # Documentation
โโโ API.md # Full API specification
โโโ FRONTEND.md # Frontend dev spec
โโโ ARCHITECTURE.md # System architecture
โโโ DESIGN.md # UI design tokens
โโโ FLOWCHART.md # Data flow diagrams
โโโ CHANGELOG.md # Version history
All generated content is subject to Middle East content compliance rules (Saudi Arabian market):
- No non-Islamic religions, holidays, or symbols
- No alcohol, pork, or gambling references
- No dating/romance, LGBTQ, or sexual content
- No Israel-related or terrorist organization content
- No magic, astrology, evolution, or occult references
See ๐ ไธญไธ้ๅฐๅ
ๅฎนๅฎกๆ ธ็บข็บฟๆๅ๏ผๅฎไน ็็๏ผ.md for the full Middle East youth content review red-line guide.
Every run automatically executes a dual-layer QA:
- Programmatic checks โ module completeness, banned modules, vocabulary fidelity, written-task red-line
- AI evaluation โ CEFR alignment, teacher friendliness, CCQ quality, 25-min capacity, Middle East compliance
Results are saved to output/qa_log.xlsx and per-unit _qa/ folders.
Current version: v3.3 โ see DOCS/CHANGELOG.md for full history.
Pass rate trend: 0% (v0.x) โ 38% (v2.0) โ 71% (v2.5) โ 100% (v2.8+, 9 consecutive passes)