refactor(schema): 重构数据库模型和 schema,清理废弃表
This commit is contained in:
@@ -208,15 +208,11 @@ class HistoryAgentOutput(BaseModel):
|
||||
|
||||
status: Literal["success", "failed"] | None = None
|
||||
sign_level: Literal["上上签", "中上签", "中下签", "下下签"] | None = None
|
||||
summary: str | None = None
|
||||
conclusion: list[str] = Field(default_factory=list)
|
||||
focus_points: list[str] = Field(default_factory=list)
|
||||
advice: list[str] = Field(default_factory=list)
|
||||
keywords: list[str] = Field(default_factory=list)
|
||||
answer: str | None = None
|
||||
key_points: list[str] = Field(default_factory=list)
|
||||
result_type: str | None = None
|
||||
suggested_actions: list[str] = Field(default_factory=list)
|
||||
divination_derived: DerivedDivinationData | None = None
|
||||
|
||||
|
||||
|
||||
@@ -109,11 +109,7 @@ def _extract_worker_agent_output(
|
||||
try:
|
||||
agent_output = AgentOutput.model_validate(agent_output_data)
|
||||
except Exception:
|
||||
normalized_payload = _normalize_agent_output_payload(agent_output_data)
|
||||
try:
|
||||
agent_output = AgentOutput.model_validate(normalized_payload)
|
||||
except Exception:
|
||||
return None
|
||||
return None
|
||||
|
||||
if not agent_output:
|
||||
return None
|
||||
@@ -123,37 +119,6 @@ def _extract_worker_agent_output(
|
||||
return payload or None
|
||||
|
||||
|
||||
def _normalize_agent_output_payload(agent_output_data: Any) -> dict[str, Any] | None:
|
||||
if not isinstance(agent_output_data, dict):
|
||||
return None
|
||||
normalized = dict(agent_output_data)
|
||||
derived = normalized.get("divination_derived")
|
||||
if isinstance(derived, dict):
|
||||
normalized["divination_derived"] = _normalize_divination_derived(derived)
|
||||
return normalized
|
||||
|
||||
|
||||
def _normalize_divination_derived(value: Any) -> Any:
|
||||
if isinstance(value, dict):
|
||||
result: dict[str, Any] = {}
|
||||
for key, item in value.items():
|
||||
normalized_key = _snake_to_camel(key)
|
||||
result[normalized_key] = _normalize_divination_derived(item)
|
||||
return result
|
||||
if isinstance(value, list):
|
||||
return [_normalize_divination_derived(item) for item in value]
|
||||
return value
|
||||
|
||||
|
||||
def _snake_to_camel(value: str) -> str:
|
||||
if "_" not in value:
|
||||
return value
|
||||
parts = value.split("_")
|
||||
if not parts:
|
||||
return value
|
||||
return parts[0] + "".join(part[:1].upper() + part[1:] for part in parts[1:])
|
||||
|
||||
|
||||
def mime_to_suffix(mime_type: str) -> str:
|
||||
mapping = {
|
||||
"image/png": "png",
|
||||
|
||||
Reference in New Issue
Block a user