The pipeline stores tm_entries_cited as a list[str] of seg_keys, but the Pydantic response schema expected dict[str, Any], causing a validation error when loading the output preview page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
from datetime import datetime
|
|
from typing import Any
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.models.output import ConfidenceTier
|
|
|
|
|
|
class FeedbackSummary(BaseModel):
|
|
"""Lightweight feedback info embedded in output row responses."""
|
|
id: UUID
|
|
flag_type: str
|
|
comment: str | None = None
|
|
user_id: UUID
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class OutputRowResponse(BaseModel):
|
|
id: UUID
|
|
instance_id: UUID
|
|
line_id: UUID
|
|
row_order: int
|
|
confidence_tier: ConfidenceTier
|
|
option_1: str
|
|
backtranslation_1: str
|
|
rationale_1: str
|
|
option_2: str | None = None
|
|
backtranslation_2: str | None = None
|
|
rationale_2: str | None = None
|
|
option_3: str | None = None
|
|
backtranslation_3: str | None = None
|
|
rationale_3: str | None = None
|
|
tm_entries_cited: list[str] | dict[str, Any] | None = None
|
|
winning_seg_key: str | None = None
|
|
character_count_option_1: int | None = None
|
|
character_count_option_2: int | None = None
|
|
character_count_option_3: int | None = None
|
|
feedback: list[FeedbackSummary] = []
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class SourceLinePreview(BaseModel):
|
|
id: UUID
|
|
row_order: int
|
|
en_gb: str
|
|
copy_type: str | None = None
|
|
creative_guidance: str | None = None
|
|
char_limit: str | None = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class OutputPreviewResponse(BaseModel):
|
|
locale_code: str
|
|
instance_id: UUID
|
|
source_lines: list[SourceLinePreview]
|
|
output_rows: list[OutputRowResponse]
|
|
total_rows: int
|
|
|
|
model_config = {"from_attributes": True}
|