refactor(schema): 重构数据库模型和 schema,清理废弃表
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
from enum import Enum
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from schemas.agent.ui_hints import UiHintsPayload
|
||||
from schemas.domain.divination import DerivedDivinationData
|
||||
@@ -45,7 +45,6 @@ class WorkerAgentOutputLite(BaseModel):
|
||||
|
||||
status: RunStatus = RunStatus.SUCCESS
|
||||
sign_level: Literal["上上签", "中上签", "中下签", "下下签"]
|
||||
summary: str = Field(min_length=1, max_length=300)
|
||||
conclusion: list[str] = Field(min_length=1, max_length=6)
|
||||
focus_points: list[str] = Field(default_factory=list, max_length=6)
|
||||
advice: list[str] = Field(min_length=1, max_length=6)
|
||||
@@ -53,20 +52,6 @@ class WorkerAgentOutputLite(BaseModel):
|
||||
answer: str = Field(min_length=1, max_length=4000)
|
||||
error: ErrorInfo | None = None
|
||||
|
||||
# Backward-compatible shadow fields for legacy consumers.
|
||||
key_points: list[str] = Field(default_factory=list, max_length=6)
|
||||
result_type: str = Field(default="structured_payload")
|
||||
suggested_actions: list[str] = Field(default_factory=list, max_length=6)
|
||||
divination_derived: DerivedDivinationData | None = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def sync_compatibility_fields(self) -> WorkerAgentOutputLite:
|
||||
if not self.key_points and self.focus_points:
|
||||
self.key_points = list(self.focus_points)
|
||||
if not self.suggested_actions and self.advice:
|
||||
self.suggested_actions = list(self.advice)
|
||||
return self
|
||||
|
||||
|
||||
class WorkerAgentOutputRich(WorkerAgentOutputLite):
|
||||
ui_hints: UiHintsPayload | None = None
|
||||
@@ -75,6 +60,8 @@ class WorkerAgentOutputRich(WorkerAgentOutputLite):
|
||||
class AgentOutput(WorkerAgentOutputRich):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
divination_derived: DerivedDivinationData | None = None
|
||||
|
||||
|
||||
WorkerAgentOutput = WorkerAgentOutputLite | WorkerAgentOutputRich
|
||||
|
||||
|
||||
Reference in New Issue
Block a user