54 lines
2.6 KiB
Python
54 lines
2.6 KiB
Python
from typing import Literal, NotRequired, TypedDict
|
|
|
|
from app.schemas.action_repair import ActionRepairPlan
|
|
from app.schemas.action_validation import ActionValidationError
|
|
from app.schemas.actions import Action
|
|
from app.schemas.base import JsonObject
|
|
from app.schemas.change_scope import ChangeScope
|
|
from app.schemas.clarification import Clarification
|
|
from app.schemas.clarification_reply import ClarificationReply
|
|
from app.schemas.component_resource import ComponentResult
|
|
from app.schemas.decision import DecisionResponse
|
|
from app.schemas.input_context import InputContext
|
|
from app.schemas.requirement import Intent, Requirement
|
|
from app.schemas.screen import Screen
|
|
from app.schemas.screen_plan import ScreenPlan
|
|
|
|
|
|
class QueryState(TypedDict):
|
|
request: JsonObject # 原始请求,保留提交时的内容
|
|
input_context: NotRequired[InputContext] # 校验后的上下文,包含最新大屏和澄清历史
|
|
intent_decision: NotRequired[DecisionResponse | None] # Jev 原始意图判断及分数
|
|
intent: NotRequired[Intent | None] # 经过置信度门控的最终意图
|
|
requirement: NotRequired[Requirement | None] # 结构化需求及信息完整性判断
|
|
change_scope: NotRequired[ChangeScope | None] # 修改范围、规划和资源需求
|
|
screen_plan: NotRequired[
|
|
ScreenPlan | None
|
|
] # 大屏设计规划,尚未获取业务数据或生成动作
|
|
component_resources: NotRequired[
|
|
ComponentResult | None
|
|
] # 已查询的前端物料能力及目录版本
|
|
actions: NotRequired[
|
|
list[Action] | None
|
|
] # 生成的动作列表,是否可模拟执行由校验结果标记
|
|
validation_passed: NotRequired[
|
|
bool | None
|
|
] # 整批模拟执行是否通过,None 表示尚未校验
|
|
validation_errors: NotRequired[
|
|
list[ActionValidationError]
|
|
] # 动作下标、错误类型和原因
|
|
simulated_screen: NotRequired[
|
|
Screen | None
|
|
] # 整批通过后的模拟快照,不覆盖原始上下文
|
|
clarification: NotRequired[Clarification | None] # 当前澄清问题及选项
|
|
repair_plan: NotRequired[ActionRepairPlan | None] # 最近一次动作修正建议
|
|
retry_count: NotRequired[int] # 已启动的自动修正次数,不含首次生成
|
|
failure_reason: NotRequired[str | None] # 停止自动修正后的失败原因
|
|
clarification_reply: NotRequired[
|
|
ClarificationReply | None
|
|
] # 待合并的用户回答或取消指令
|
|
answer: NotRequired[str | None] # 问答节点生成的回答或建议
|
|
status: NotRequired[
|
|
Literal["running", "cancelled", "failed"]
|
|
] # 流程继续、用户取消或动作修正失败
|