feat:优化意图识别
This commit is contained in:
@@ -24,8 +24,9 @@ class PlanComponent(ExtensibleModel):
|
||||
plan_id: NonBlankString = Field(
|
||||
description="规划内的组件编号,用于关联资源,不作为新增组件的实际 ID"
|
||||
)
|
||||
disposition: Literal["keep", "modify", "add", "remove"] = Field(
|
||||
description="保留、调整、新增或移除,只表达规划意图,不代表执行能力已经支持"
|
||||
disposition: Literal["keep", "modify", "add", "remove", "replace"] = Field(
|
||||
description="保留、调整、新增、移除或更换类型,只表达规划意图,不代表执行能力已经支持;"
|
||||
"replace 表示把 target_id 换成 component_type 对应的物料,保留原位置"
|
||||
)
|
||||
target_id: NonBlankString | None = Field(
|
||||
default=None, description="已有组件 ID,新增时必须为空"
|
||||
@@ -53,7 +54,9 @@ class PlanComponent(ExtensibleModel):
|
||||
if self.target_id is not None:
|
||||
raise ValueError("新增组件不能指定已有 target_id")
|
||||
elif self.target_id is None:
|
||||
raise ValueError("保留、调整或移除组件必须提供 target_id")
|
||||
raise ValueError("保留、调整、移除或更换组件必须提供 target_id")
|
||||
if self.disposition == "replace" and self.component_type is None:
|
||||
raise ValueError("更换组件必须指定新的 component_type")
|
||||
return self
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user