File size: 656 Bytes
6f718f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pathlib import Path

from pydantic import BaseModel, ConfigDict, Field


class Question(BaseModel):
    model_config = ConfigDict(extra="ignore")

    task_id: str = Field(min_length=1)
    question: str = Field(min_length=1)
    file_name: str = ""


class Answer(BaseModel):
    task_id: str = Field(min_length=1)
    submitted_answer: str = Field(min_length=1)


class RunRecord(BaseModel):
    question: Question
    attachment: Path | None = None
    raw_answer: str
    submitted_answer: str


class ScoreResponse(BaseModel):
    username: str
    score: float
    correct_count: int
    total_attempted: int
    message: str
    timestamp: str