feat:添加图表数据

This commit is contained in:
2026-10-01 09:25:01 -07:00
parent dd2fd8bcde
commit ce575ec6a0
32 changed files with 108 additions and 48 deletions
+12 -2
View File
@@ -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__ = [
+1 -2
View File
@@ -21,6 +21,5 @@ class AgentResult(BaseModel):
message_id: str # 本次用户输入的 ID,不是助手回复 ID
status: Literal["completed", "waiting_for_input", "failed", "cancelled"]
actions: list[Action] = Field(default_factory=list)
answer: str | None = None
answer: str | None = None # 回答,或失败时由模型总结的原因说明
clarification: Clarification | None = None
failure_reason: str | None = None
-3
View File
@@ -20,6 +20,3 @@ RESOURCE_QUERY_SUPPORTED = False
RESOURCE_FALLBACK_ASSUMPTION = (
"尚未接入物料目录之外的资源查询,所需内容使用物料默认配置和示例数据"
)
# 面向用户的失败说明,不暴露内部校验术语
USER_FAILURE_MESSAGE = "抱歉,这次没能完成修改,请换个说法或稍后再试"