feat:完成重构和测试

This commit is contained in:
2026-10-02 08:47:24 -07:00
parent 5b1e6c5654
commit 62a5b2a8f4
15 changed files with 138 additions and 43 deletions
+7 -1
View File
@@ -10,6 +10,7 @@ from langchain.agents import AgentState
from langchain.tools import ToolRuntime, tool
from langchain_core.messages import ToolMessage
from langgraph.types import Command
from pydantic import Field
from app.actions.batch import BatchError, run_batch
from app.schemas.actions import Action, AddAction
@@ -63,7 +64,12 @@ def _result_text(actions: list[Action]) -> str:
@tool
def apply_actions(
actions: list[Action], runtime: ToolRuntime[ScreenAgentContext]
actions: Annotated[
list[Action],
# 空的一批会清掉之前成功的结果;参数校验失败不改状态,之前的结果保留
Field(min_length=1, description="至少一个动作;不需要修改时不要调用,直接回复"),
],
runtime: ToolRuntime[ScreenAgentContext],
) -> Command:
"""提交本次要对大屏做的全部修改