TalimBot - Ψ³ΫΨ³ΨͺΩ Ϊ―Ψ±ΩΩβΨ¨ΩΨ―Ϋ ΩΩΨ΄Ω ΩΨ― Ψ―Ψ§ΩΨ΄βΨ’Ω ΩΨ²Ψ§Ω
A full-stack intelligent student grouping system using AI-powered analysis with FastAPI backend and GitHub Pages frontend.
π― Overview
TalimBot groups 30 real students based on MBTI personality types, learning styles, math grades, and peer preferences using AI (GPT-4o-mini via OpenRouter). Teachers control when students can view their group assignments.
Real Student Data
- 30 Students from class 1061 (Ψ―ΩΩ ΨͺΨ¬Ψ±Ψ¨Ϋ)
- Persian Names: Full Persian names from actual class roster
- National Code Authentication: Students login with their national ID
- Math Grades: Real grades from student records
π Quick Start (Local Development)
Prerequisites
- Python 3.8+ installed
- Modern web browser
- Internet connection (for AI grouping)
Step 1: Start Backend (30 seconds)
# Navigate to backend folder
cd backend
# Install dependencies (first time only)
pip install -r requirements.txt
# Start the server
python main.py
Server runs on: http://localhost:8000
Keep this terminal running!
Step 2: Open Frontend (10 seconds)
Option A - Direct Open (Easiest):
- Double-click
index.htmlin File Explorer
Option B - Local Server (Recommended):
# In a NEW terminal window
python -m http.server 3000
Then visit: http://localhost:3000
π₯ Login Credentials
Students (30 students available)
Login with:
- Student Number: S001, S002, ..., S030
- National Code: Each student's 10-digit national ID
Example:
- Student Number:
S001 - National Code:
929986644 - Name: Ψ’Ψ―ΫΩΩ ΩΎΩΨ± - ΫΨ§Ψ³Ω Ω
Teacher
- Password:
teacher123
π How It Works
For Students:
Login
- Enter student number (S001-S030)
- Enter your 10-digit national code
- System displays your Persian name
Complete Profile
- Take MBTI test (link provided)
- Take VARK learning style test (link provided)
- Fill out AMS and Cooperative preferences
- Select up to 4 preferred groupmates
- Save your information
View Group (after teacher enables)
- See your group number
- View all group members
- Read AI reasoning in Persian
For Teachers:
Monitor Progress
- View dashboard with statistics
- See which students completed profiles
- Check readiness for grouping
Perform Grouping
- Enter course name
- Click "Start Grouping"
- AI analyzes all data (10-30 seconds)
- Review generated groups with Persian reasoning
Control Visibility
- Groups are hidden by default
- Click "Show Results to Students"
- Toggle visibility on/off anytime
Manage Data
- View all student information
- Edit student data if needed
- Reset grouping when necessary
π Deployment to GitHub Pages
Part 1: Deploy Frontend to GitHub Pages
Create GitHub Repository
# Initialize git (if not already done) git init git add . git commit -m "Initial commit with real student data" # Create repo on GitHub and push git remote add origin https://github.com/talimbot/talimbot.git git branch -M main git push -u origin mainEnable GitHub Pages
- Go to repository Settings β Pages
- Source: Deploy from branch
main - Folder:
/ (root) - Click Save
Your site will be live at:
https://talimbot.github.io/talimbot/
Part 2: Deploy Backend to Render.com (Free)
Create Render Account
- Visit render.com
- Sign up with GitHub
Create New Web Service
- Click "New +" β "Web Service"
- Connect your GitHub repository
- Settings:
- Name:
talimbot-backend - Environment:
Python 3 - Build Command:
pip install -r backend/requirements.txt - Start Command:
cd backend && uvicorn main:app --host 0.0.0.0 --port $PORT - Plan: Free
- Name:
Add Environment Variable
- In Render dashboard β Environment
- Add:
OPENROUTER_API_KEY=your-api-key - Optionally:
TEACHER_PASSWORD=your-password
Get Your Backend URL
- Copy the URL (e.g.,
https://talimbot-backend.onrender.com)
- Copy the URL (e.g.,
Part 3: Update Frontend to Use Deployed Backend
Update API_BASE_URL in BOTH files:
assets/js/data.jsassets/js/grouping.js
// Change from:
const API_BASE_URL = 'http://localhost:8000/api';
// To:
const API_BASE_URL = 'https://talimbot-backend.onrender.com/api';
Commit and push changes:
git add .
git commit -m "Update API URL for production"
git push
GitHub Pages will auto-deploy in ~1 minute.
π§ Configuration
API Key (OpenRouter)
Located in backend/grouping_logic.py:
OPENROUTER_API_KEY = 'sk-or-v1-...'
Teacher Password
Located in backend/main.py (SystemData model):
teacherPassword: str = "teacher123"
Change as needed for security.
Student Data
Students are initialized in backend/main.py in the load_data() function.
All 30 real students with Persian names and national codes are pre-loaded.
π Project Structure
talimbot/
βββ backend/
β βββ main.py # FastAPI server with real student data
β βββ grouping_logic.py # AI grouping with OpenRouter
β βββ requirements.txt # Python dependencies
β βββ README.md # Backend documentation
β βββ data/
β βββ students.json # Auto-created data storage
β
βββ assets/
β βββ css/
β β βββ styles.css
β βββ js/
β βββ data.js # API client for student data
β βββ grouping.js # API client for grouping
β
βββ pages/
β βββ login.html # Login with national code
β βββ student-dashboard.html
β βββ student-data.html
β βββ teacher-dashboard.html
β βββ group-view.html
β
βββ Icons/ # UI icons
βββ index.html # Redirects to login
βββ README.md # This file
βββ .gitignore # Git ignore rules
βββ start-backend.ps1 # Windows startup script
π― Features
β Implemented
- Real Student Data: 30 actual students with Persian names
- National Code Authentication: Secure login using national IDs
- Persistent Storage: JSON database on backend
- AI-Powered Grouping: OpenRouter GPT-4o-mini integration
- Persian Language: Full RTL support with Persian reasoning
- Teacher Controls: Show/hide results, reset grouping
- Math Grades: Real grades from class records
- MBTI & Learning Styles: Comprehensive personality analysis
- Peer Preferences: Students select preferred groupmates
π¨ UI Features
- Modern, responsive design with Tailwind CSS
- Persian (RTL) interface
- Real-time validation
- Progress indicators
π Troubleshooting
"Failed to fetch" errors
Problem: Backend not running or wrong URL Solution:
- Check backend is running: Visit
http://localhost:8000 - Should see:
{"message":"TalimBot API is running"} - Check
API_BASE_URLin JS files matches backend
Students can't login
Problem: Wrong national code Solution:
- National code must be exactly 10 digits
- Must match the code in backend database
- Check
backend/main.pyfor correct codes
Students can't see groups
Problem: Teacher hasn't enabled visibility Solution:
- Teacher must click "Show Results to Students"
- Button appears after grouping is complete
Grouping fails
Problem: API error or no internet Solution:
- Check internet connection
- Verify OpenRouter API key is valid
- Check backend logs for errors
- System has fallback random grouping if AI fails
π Student List (Sample)
| # | Student Number | Name | National Code | Math Grade |
|---|---|---|---|---|
| 1 | S001 | Ψ’Ψ―ΫΩΩ ΩΎΩΨ± - ΫΨ§Ψ³Ω Ω | 929986644 | 16.0 |
| 2 | S002 | Ψ§ΨΩ Ψ―Ψ²Ψ§Ψ―Ω - ΩΎΨ±ΫΨ§ | 980085330 | 12.0 |
| 3 | S003 | Ψ§Ϊ©Ψ¨Ψ±Ψ²Ψ§Ψ―Ω - ΩΨ§Ψ·Ω Ω | 970154550 | 11.0 |
| 4 | S004 | Ψ§ΩΩΫ Ω ΩΨ± - Ψ’ΩΨ§ΩΫΨͺΨ§ | 26425955 | 17.0 |
| 5 | S005 | Ψ§Ω ΫΨ±Ϋ - Ω Ψ±ΫΩ | 980093341 | 18.0 |
| ... | ... | ... | ... | ... |
| 30 | S030 | ΩΨΨ―ΨͺΫ - Ψ¨Ψ§Ψ±Ψ§Ω | 929916913 | 12.0 |
Full list available in backend/main.py
π Security Notes
Current (Demo/Development):
- β Simple password authentication
- β CORS allows all origins
- β National codes as passwords
Recommended for Production:
- π Use environment variables for secrets
- π Implement JWT token authentication
- π Enable HTTPS only
- π Add rate limiting
- π Use PostgreSQL instead of JSON
- π Hash national codes
- π Implement proper session management
π API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Health check |
/api/students |
GET | Get all students |
/api/student/{id} |
GET | Get one student |
/api/student/{id} |
PUT | Update student |
/api/auth/student |
POST | Authenticate student |
/api/auth/teacher |
POST | Authenticate teacher |
/api/grouping/perform |
POST | Run AI grouping |
/api/grouping/status |
GET | Get stats |
/api/grouping/toggle-visibility |
POST | Show/hide results |
/api/grouping/reset |
POST | Clear grouping |
/api/student/{id}/group |
GET | Get student's group |
π Technologies Used
Backend
- FastAPI - Modern Python web framework
- Uvicorn - ASGI server
- Pydantic - Data validation
- aiohttp - Async HTTP client
- OpenRouter API - AI integration
Frontend
- HTML5 / CSS3 - Structure and styling
- Tailwind CSS - Utility-first CSS
- JavaScript (Async/Await) - Modern JS
- Fetch API - HTTP requests
Deployment
- GitHub Pages - Frontend hosting (free)
- Render.com - Backend hosting (free)
π License
This project is for educational purposes.
π Credits
- Student data from class 1061 (Ψ―ΩΩ ΨͺΨ¬Ψ±Ψ¨Ϋ)
- AI grouping powered by OpenRouter (GPT-4o-mini)
β Pre-Launch Checklist
- Backend running locally
- Students can login with national codes
- Teacher can login with password
- Grouping works with AI
- Visibility toggle works
- All 30 students load correctly
- Persian names display properly
- Math grades show correctly
- Backend deployed to Render
- Frontend deployed to GitHub Pages
- API URLs updated for production
Live URL: https://talimbot.github.io/talimbot/pages/login.html
Last Updated: December 2025