feat:添加图表数据
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"""动作类型统一入口,新增操作时在这里显式加入联合类型"""
|
||||
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Self
|
||||
|
||||
from pydantic import Field, TypeAdapter
|
||||
from pydantic import Field, TypeAdapter, model_validator
|
||||
|
||||
from .add import AddAction
|
||||
from .base import ActionModel, BaseAction
|
||||
@@ -22,6 +22,16 @@ action_adapter = TypeAdapter(Action)
|
||||
|
||||
class ActionBatch(ActionModel):
|
||||
actions: list[Action] = Field(description="按数组顺序执行的动作列表,允许为空")
|
||||
unsupported_reason: str | None = Field(
|
||||
default=None,
|
||||
description="需求中有任何部分无法用现有动作或查到的字段完成时,说明缺少什么能力,此时 actions 为空;能完成时为 null",
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def unsupported_has_no_actions(self) -> Self:
|
||||
if self.unsupported_reason and self.actions:
|
||||
raise ValueError("填写 unsupported_reason 时 actions 必须为空,不能只执行需求的一部分")
|
||||
return self
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
||||
Reference in New Issue
Block a user