From 1041f3d62401249cdfeff0b4043ceac299978a9e Mon Sep 17 00:00:00 2001 From: Ethan-Zhang Date: Thu, 13 Nov 2025 05:04:21 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20pydantic=E8=A7=84=E8=8C=83=E4=B8=8EField?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/scheduler/executor/agent.py | 12 ++++++++---- apps/scheduler/executor/step.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/scheduler/executor/agent.py b/apps/scheduler/executor/agent.py index 6e8a7b6a3..a3068d11c 100644 --- a/apps/scheduler/executor/agent.py +++ b/apps/scheduler/executor/agent.py @@ -71,21 +71,25 @@ class MCPAgentExecutor(BaseExecutor): ) resoning_llm: ReasoningLLM = Field( description="推理大模型", - default=ReasoningLLM() + default_factory=ReasoningLLM, + exclude=True ) function_call_llm: FunctionLLM = Field( description="函数调用大模型", - default=FunctionLLM() + default_factory=FunctionLLM, + exclude=True ) app_owner: str = Field(default="", description="应用所有者") auto_execute: bool | None = Field(default=None, description="是否自动执行(来自请求)") mcp_host: MCPHost = Field( description="MCP主机", - default=MCPHost() + default_factory=MCPHost, + exclude=True ) mcp_planner: MCPPlanner = Field( description="MCP规划器", - default=MCPPlanner() + default_factory=MCPPlanner, + exclude=True ) async def init_llms(self) -> None: diff --git a/apps/scheduler/executor/step.py b/apps/scheduler/executor/step.py index 04600e840..525f9efc8 100644 --- a/apps/scheduler/executor/step.py +++ b/apps/scheduler/executor/step.py @@ -6,10 +6,10 @@ import logging import uuid from collections.abc import AsyncGenerator from datetime import UTC, datetime -from typing import Any, Field +from typing import Any import json import jsonschema -from pydantic import ConfigDict +from pydantic import ConfigDict, Field from apps.scheduler.call.core import CoreCall from apps.scheduler.call.empty import Empty -- Gitee