- FastAPI backend with JWT auth, roles (admin/moderator/user) - PDF upload (up to 500MB) with streaming, PyMuPDF text extraction - ChromaDB vectorization per page with metadata - LiteLLM AI question extraction from PDF (not generation) - Image extraction from PDF pages, graceful fallback - Quiz modes: timed (countdown timer) + learning (answers shown inline) - Page-by-page question navigation with dot navigator - TTS endpoint using LiteLLM (Google Vertex / OpenAI voices) - Admin dashboard: AI model management per task, user role management - Moderator role: upload PDFs, create sections, generate quizzes - Spaced repetition reminders via SMTP email (SM-2 intervals) - APScheduler daily reminder jobs - Celery + Redis for background PDF processing - React frontend with all pages - Docker Compose deployment (nginx + backend + celery + redis) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.1 KiB
Python
54 lines
1.1 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class QuizCreate(BaseModel):
|
|
section_id: int
|
|
title: str
|
|
mode: str = "timed" # timed, learning
|
|
time_limit_minutes: int | None = None
|
|
|
|
|
|
class QuestionResponse(BaseModel):
|
|
id: int
|
|
question_text: str
|
|
question_type: str
|
|
options: list[str] | None
|
|
image_path: str | None = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class QuestionWithAnswer(QuestionResponse):
|
|
correct_answer: str
|
|
explanation: str | None
|
|
page_reference: int | None
|
|
|
|
|
|
class QuizResponse(BaseModel):
|
|
id: int
|
|
section_id: int
|
|
user_id: int
|
|
title: str
|
|
questions_count: int
|
|
mode: str
|
|
time_limit_minutes: int | None
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class QuizDetail(QuizResponse):
|
|
questions: list[QuestionResponse] = []
|
|
|
|
|
|
class QuizLearningDetail(QuizResponse):
|
|
"""Learning mode — includes answers and explanations."""
|
|
questions: list[QuestionWithAnswer] = []
|
|
|
|
|
|
class QuizReview(QuizResponse):
|
|
questions: list[QuestionWithAnswer] = []
|