Forked from SkyCascade/SkyLearn and extended with AI-driven lesson generation, RAG-based document retrieval, automated quiz creation, AI chatbot tutoring, and Yolo:Farm AIoT education features.
- Overview
- What Changed from the Original SkyLearn
- Features
- Tech Stack
- Project Structure
- Requirements
- Installation
- Environment Variables
- Usage
- AI Features in Detail
- References
- License
SkyLearn AI is a full-featured Learning Management System built with Django, enhanced with AI capabilities powered by Google Gemini. It provides traditional LMS functions (course management, grading, quizzes, student/lecturer management) alongside modern AI-powered tools for automated lesson generation, intelligent quiz creation, and an AI chatbot tutor.
The project is designed as a university-level LMS with support for multiple user roles (Admin, Lecturer, Student, Parent, Department Head), course enrollment, grade tracking, payment integration (Stripe), and internationalization (English, French, Spanish, Russian).
This fork introduces the following major additions and modifications on top of SkyCascade/SkyLearn:
An entirely new Django app (ai_core/) containing:
- Gemini LLM integration via LangChain (
langchain-google-genai) - AI Lesson Generator — generates structured HTML lessons from any topic
- AI Quiz Generator — auto-creates multiple-choice questions from lesson content
- RAG (Retrieval-Augmented Generation) pipeline — parses uploaded documents (PDF, DOCX, PPTX), chunks them, embeds with Gemini Embedding API, and performs cosine-similarity semantic search to enrich lesson generation
- AI Chatbot — a floating conversational assistant (SkyLearn AI Assistant) available on every page
- Yolo:Farm AIoT Lesson Service — specialized lesson pipeline for IoT education with Yolo:Bit microcontroller, generating real MicroPython code that can be flashed to hardware via Web Serial API
- Chatbot widget (
templates/snippets/chatbot_widget.html,static/css/chatbot.css,static/js/chatbot.js) - Yolo:Farm UI (
static/css/yolo_farm.css,static/js/yolo_farm.js) — interactive lesson viewer with code blocks, serial monitor, and hardware upload functionality
- Database: Switched from SQLite to PostgreSQL (Neon serverless)
- Media storage: Added Cloudinary integration for cloud file storage
- Dependencies: Added
langchain,langchain-google-genai,PyPDF2,python-docx,python-pptx,htmldocx,numpy,psycopg2-binary,dj-database-url,cloudinary,django-cloudinary-storage - Font: Added Google Inter font with Vietnamese support
config/settings.py— addedai_coreto installed apps, PostgreSQL database config, Cloudinary storage configconfig/urls.py— addedai/URL prefix for AI endpointstemplates/base.html— included chatbot widget, Yolo:Farm CSS/JS, Inter fontcourse/models.py— addedhtml_contentfield toUploadmodel for storing generated lessonsrequirements/base.txt— added AI and cloud dependencies
- Dashboard — School demographics and analytics (admin only)
- News & Events — Accessible to all users
- User Management — Admin manages students, lecturers, parents, department heads
- Course Management — Add/drop courses, course allocation to lecturers
- Grading System — Attendance, mid exam, final exam, assignment, quiz scores; auto-calculated total, grade (A+ to F), GPA, and CGPA
- Grade Comments — Automatic pass/fail classification
- Assessment & Grade Results — Dedicated pages for students
- Session/Semester Management — Grouped assessments and grades by semester
- Course Materials — Upload documents (PDF, DOCX, PPTX, XLS, ZIP, etc.) and videos per course
- PDF Generator — Registration slips and grade result reports
- Search — Full-text search across users, courses, and programs
- Payment Integration — Stripe-based invoicing
- Quiz System — Multiple choice, True/False, question categories, progress tracking, pass marks, score history, randomized question order
- Internationalization — English, French, Spanish, Russian (via
django-modeltranslation) - Page Access Restriction — Role-based permissions
- 🤖 AI Lesson Generation — Generate complete HTML lessons from a topic using Gemini LLM
- 📚 RAG-Enhanced Lessons — Select uploaded course documents as context; the system parses, chunks, embeds, and semantically retrieves relevant content to produce more accurate lessons
- 📝 AI Quiz Generation — Auto-create multiple-choice quizzes from any lesson content with configurable difficulty (easy/medium/hard) and question count
- 💬 AI Chatbot Tutor — Floating chat widget on every page; supports multi-turn conversation, answers academic questions, provides study tips
- 🌾 Yolo:Farm AIoT Lessons — Specialized lesson pipeline for IoT education with the Yolo:Bit microcontroller (OhStem platform); generates real MicroPython code blocks
- 🔌 Web Serial API — Upload generated MicroPython code directly to physical Yolo:Bit hardware from the browser
- 📄 Lesson to DOCX Export — Save AI-generated lessons as Word documents in course materials
| Layer | Technology |
|---|---|
| Backend | Django 4.2 (LTS), Python 3.8+ |
| AI / LLM | Google Gemini (via LangChain), Gemini Embedding API |
| RAG | Custom pipeline: PyPDF2, python-docx, python-pptx → chunking → Gemini embeddings → cosine similarity (NumPy) |
| Database | PostgreSQL (Neon serverless) |
| Media Storage | Cloudinary |
| Frontend | Bootstrap 5.3, jQuery 3.7, FontAwesome 6.5, SCSS |
| Payments | Stripe |
| PDF Generation | xhtml2pdf, ReportLab |
| DOCX Generation | python-docx, htmldocx |
| Admin Panel | Django JET (reboot) |
| i18n | django-modeltranslation (EN, FR, ES, RU) |
| Static Files | WhiteNoise |
SkyLearnAI/
├── ai_core/ # 🆕 AI module (lesson, quiz, chatbot, RAG)
│ ├── models.py # AIGeneration, DocumentChunk models
│ ├── views.py # API endpoints for AI features
│ ├── urls.py # /ai/ URL routes
│ └── services/
│ ├── base.py # Abstract LLM service (LangChain)
│ ├── gemini.py # Google Gemini provider
│ ├── lesson.py # General lesson generation
│ ├── yolo_farm_lesson.py # Yolo:Farm IoT lesson generation
│ ├── quiz.py # Quiz generation with JSON parsing
│ ├── chatbot.py # Conversational AI assistant
│ ├── rag.py # Embedding, indexing, semantic search
│ └── document_parser.py # PDF/DOCX/PPTX text extraction + chunking
│
├── accounts/ # User management (Student, Lecturer, Parent, etc.)
├── config/ # Django settings, root URLs, WSGI/ASGI
├── core/ # News & Events, Session, Semester, ActivityLog
├── course/ # Programs, Courses, Uploads, Videos
├── quiz/ # Quiz system (MCQ, True/False, categories)
├── result/ # Grading: TakenCourse, Result (GPA/CGPA)
├── search/ # Full-text search
├── payments/ # Stripe payment & invoicing
│
├── templates/ # Django HTML templates
│ └── snippets/
│ └── chatbot_widget.html # 🆕 Floating chatbot UI
├── static/
│ ├── css/
│ │ ├── chatbot.css # 🆕 Chatbot styles
│ │ └── yolo_farm.css # 🆕 Yolo:Farm lesson UI styles
│ └── js/
│ ├── chatbot.js # 🆕 Chatbot client logic
│ └── yolo_farm.js # 🆕 Yolo:Farm + Web Serial API logic
│
├── requirements/
│ ├── base.txt # All dependencies
│ ├── local.txt # Development extras (black, factory-boy)
│ └── production.txt # Production extras
├── manage.py
└── .env.example # Environment variable template
- Python 3.8+
- PostgreSQL (or Neon serverless)
- Google Gemini API Key (for AI features)
- Cloudinary Account (for media storage)
- Clone the repository
git clone https://github.com/nat50/SkyLearnAI.git
cd SkyLearnAI- Create and activate a virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate- Install dependencies
pip install -r requirements.txt- Configure environment variables
cp .env.example .envEdit .env with your actual credentials (see Environment Variables below).
- Run database migrations
python manage.py migrate- Create a superuser (admin)
python manage.py createsuperuser- Start the development server
python manage.py runserver- Open http://127.0.0.1:8000 in your browser.
Create a .env file in the project root with the following variables:
# Django
DEBUG=True
SECRET_KEY=your-random-secret-key
# Email
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_FROM_ADDRESS=SkyLearn <youremail@example.com>
EMAIL_HOST_USER=youremail@example.com
EMAIL_HOST_PASSWORD=yourpassword
# PostgreSQL Database
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432
# Cloudinary (media storage)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Google Gemini AI (required for AI features)
GOOGLE_API_KEY=your_gemini_api_key| Role | Access |
|---|---|
| Admin | Full dashboard, manage students/lecturers/courses, view analytics |
| Lecturer | Submit grades, view allocated courses, upload materials, generate AI lessons |
| Student | Enroll in courses, view grades/results, take quizzes, use AI chatbot |
| Parent | View connected student's information |
| Endpoint | Method | Description |
|---|---|---|
/ai/lesson/generate/ |
POST | Generate an AI lesson (with optional RAG context) |
/ai/lesson/save-doc/ |
POST | Save generated lesson as DOCX to course materials |
/ai/lesson/<id>/html/ |
GET | Retrieve stored HTML lesson content |
/ai/quiz/generate/ |
POST | Generate MCQ quiz from lesson content |
/ai/chatbot/ |
POST | Send message to AI chatbot |
- Document Upload — Lecturers upload PDF/DOCX/PPTX files to a course
- Text Extraction —
document_parser.pyextracts text using PyPDF2, python-docx, or python-pptx - Chunking — Text is split into 4000-character overlapping chunks (200-char overlap)
- Embedding — Each chunk is embedded using
gemini-embedding-001via LangChain - Storage — Chunks and embeddings are stored in the
DocumentChunkmodel (PostgreSQL JSON field) - Retrieval — At lesson generation time, the user's topic is embedded and compared against stored chunks using cosine similarity (NumPy)
- Generation — Top-K relevant chunks are injected into the Gemini prompt as context
- Generates lessons specifically for the Yolo:Bit microcontroller (OhStem platform)
- Code blocks contain real MicroPython code using OhStem libraries (
from yolobit import *) - Lessons can use the Yolo:Farm textbook PDF as RAG context (auto-detected)
- Generated code can be uploaded to physical hardware via the Web Serial API directly from the browser
- Upstream LMS: SkyCascade/SkyLearn
- Quiz module: tomwalker/django_quiz
- AI Provider: Google Gemini
- LangChain: langchain.com
- Yolo:Bit / OhStem: ohstem.vn
This project is licensed under the MIT License.
Original SkyLearn © 2023 Adil Mohak.
