| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- from __future__ import annotations
- """方案校验结果模型:PlanValidationResult包含问题清单、预算估算与修改意见。"""
- from typing import Literal
- from pydantic import Field
- from app.schemas.common import AppModel
- ValidationSeverity = Literal[
- "error",
- "warning",
- ]
- BudgetStatus = Literal[
- "within_known_budget",
- "over_budget",
- "unknown",
- ]
- class ValidationIssue(AppModel):
- """行程校验发现的单个问题。"""
- code: str
- severity: ValidationSeverity
- message: str
- day_index: int | None = None
- activity_sequence: int | None = None
- class BudgetEstimate(AppModel):
- """当前能够确定的预算估算。
- 航班仍标记为接口报价,不擅自解释为
- 单人价格或全部旅客总价。
- """
- currency: str = "CNY"
- flight_quote: float | None = Field(
- default=None,
- ge=0,
- )
- hotel_estimate: float | None = Field(
- default=None,
- ge=0,
- )
- explicit_activity_costs: float = Field(
- default=0,
- ge=0,
- )
- known_total: float | None = Field(
- default=None,
- ge=0,
- )
- user_budget: float | None = Field(
- default=None,
- ge=0,
- )
- remaining_known_budget: float | None = None
- status: BudgetStatus = "unknown"
- coverage_note: str
- class PlanValidationResult(AppModel):
- """确定性校验阶段的完整结果。"""
- is_valid: bool
- error_count: int = Field(ge=0)
- warning_count: int = Field(ge=0)
- issues: list[ValidationIssue] = Field(
- default_factory=list
- )
- budget: BudgetEstimate
- # 后续Supervisor将这些信息交给Planner重写。
- revision_feedback: list[str] = Field(
- default_factory=list
- )
|