New feature: generate flashcards from PDF sections using AI, completely separate from the existing quiz system. Backend: - FlashcardDeck + Flashcard models with cascade deletes - flashcard_tag_links table for tag classification (reuses question_tags) - /api/flashcards/ router: CRUD for decks, browse/search cards, tag filtering - generate_flashcard_deck Celery task with chunked processing + progress - FLASHCARD_PROMPT in extraction_modes.py (15 cards per chunk) - "flashcard" added to admin model task types Frontend: - FlashcardsPage: deck grid + card browser with search/filter - FlashcardStudyPage: flip cards, mark known/review, keyboard nav, shuffle, progress bar, completion screen - DocumentDetailPage: "Create Flashcards" button alongside "Extract Quiz" - Navbar: Flashcards link - AdminPage: flashcard in model task dropdown Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
670 B
Python
29 lines
670 B
Python
from datetime import datetime
|
|
from pydantic import BaseModel
|
|
|
|
class FlashcardDeckCreate(BaseModel):
|
|
section_id: int
|
|
title: str
|
|
model_id: str | None = None
|
|
|
|
class FlashcardResponse(BaseModel):
|
|
id: int
|
|
front: str
|
|
back: str
|
|
page_reference: int | None = None
|
|
image_path: str | None = None
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class FlashcardDeckResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
section_id: int | None = None
|
|
user_id: int
|
|
card_count: int
|
|
created_at: datetime
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class FlashcardDeckDetail(FlashcardDeckResponse):
|
|
cards: list[FlashcardResponse] = []
|