Embedding:
- Embedding model now configurable via Admin UI (More tab) or LITELLM_EMBEDDING_MODEL env
- Calls LiteLLM proxy directly via httpx (bypasses LiteLLM library param validation)
- Passes dimensions=1024 to proxy; Redis setting overrides env var
- Default model: ge-gemini-embedding-001 (Gemini AI Studio, 1024-dim)
- Test button in admin UI to verify model works
- Fixed vector_service to use httpx + Redis model (was broken with non-prefixed model names)
Polly:
- Global enable/disable toggle in Admin → More settings (stored in Redis)
- /tts/voices filters out polly/* when disabled
- /tts/speak rejects polly requests when disabled
Job cancellation:
- POST /quizzes/job/{job_id}/cancel endpoint
- Cancel button on JobsPage for running jobs
- Celery task checks Redis status at each chunk boundary and exits cleanly
- Fixes DB lock on restart caused by cancelled jobs leaving open transactions
Admin UI:
- Settings tab renamed to "More" (heading: More Settings)
- Model row overflow fixed (minWidth: 0 + ellipsis on model_id)
- Embedding model search shows all proxy models (no auto-filter by "embed")
- Navbar correctly excludes cancelled/failed jobs from "extracting" count
README:
- Added Rebuild & Restart section with commands
- Updated embedding model reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
1.8 KiB
Python
70 lines
1.8 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
|
|
model_id: str | None = None # override extraction model
|
|
question_category_id: int | None = None # assign extracted questions to this bank category
|
|
extraction_mode: str = "standard"
|
|
# standard — current working mode (inline Correct Answer / Preferred Response)
|
|
# questions_only — extract Q+options only, no answers (admin fills later)
|
|
# two_step — separate answer key section (PREP 2013 style)
|
|
# regex — AI analyses format then extracts answer key with regex
|
|
# ai_decide — AI reads a sample and decides which approach to use
|
|
|
|
|
|
class QuizUpdate(BaseModel):
|
|
title: str
|
|
|
|
|
|
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
|
|
skipped_questions: str | None = None
|
|
category_id: int | None = None
|
|
created_at: datetime
|
|
deleted_at: datetime | None = None
|
|
is_published: int = 1
|
|
|
|
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] = []
|