From d5e818b2c87beb4d14a0e66197cb904ac913d7f1 Mon Sep 17 00:00:00 2001 From: zxstty Date: Thu, 18 Sep 2025 23:47:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?get=5Fflow=5Fname=E5=A2=9E=E5=8A=A0static?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97=EF=BC=8Cagent=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=99=A8=E6=AF=8F=E6=AC=A1=E4=BA=A7=E7=94=9F=E6=96=B0=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/scheduler/executor/agent.py | 2 ++ apps/scheduler/mcp_agent/plan.py | 1 + 2 files changed, 3 insertions(+) diff --git a/apps/scheduler/executor/agent.py b/apps/scheduler/executor/agent.py index 5fd1688e..dd84a690 100644 --- a/apps/scheduler/executor/agent.py +++ b/apps/scheduler/executor/agent.py @@ -1,5 +1,6 @@ # Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. """MCP Agent执行器""" +from datetime import datetime,UTC import logging import uuid @@ -311,6 +312,7 @@ class MCPAgentExecutor(BaseExecutor): async def get_next_step(self) -> None: """获取下一步""" + self.task.tokens.time = datetime.now(UTC).timestamp() self.task.state.retry_times = 0 if self.task.state.step_cnt < self.max_steps: self.task.state.step_cnt += 1 diff --git a/apps/scheduler/mcp_agent/plan.py b/apps/scheduler/mcp_agent/plan.py index b85043ea..489efc74 100644 --- a/apps/scheduler/mcp_agent/plan.py +++ b/apps/scheduler/mcp_agent/plan.py @@ -88,6 +88,7 @@ class MCPPlanner(MCPBase): # 使用GoalEvaluationResult模型解析结果 return GoalEvaluationResult.model_validate(evaluation) + @staticmethod async def get_flow_name( user_goal: str, resoning_llm: ReasoningLLM = ReasoningLLM(), -- Gitee From 937afc955632339ea29428ab215dd004689034d3 Mon Sep 17 00:00:00 2001 From: zxstty Date: Sun, 21 Sep 2025 21:04:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4mcp=E8=8E=B7=E5=BE=97?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E7=9A=84admin=E9=AA=8C=E8=AF=81&=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0mcp=E5=AE=89=E8=A3=85=E7=9A=84admin=E9=AA=8C=E8=AF=81&?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8E=E8=B5=B7=E6=9C=8D=E5=8A=A1=E5=90=8C?= =?UTF-8?q?=E5=90=8D=E7=9A=84admin=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/main.py | 5 ++--- apps/routers/mcp_service.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/main.py b/apps/main.py index 99b7de0c..a7662062 100644 --- a/apps/main.py +++ b/apps/main.py @@ -83,7 +83,7 @@ logging.basicConfig( ) -async def add_no_auth_user() -> None: +async def add_defaut_admin_user()->None: """ 添加无认证用户 """ @@ -123,8 +123,7 @@ async def init_resources() -> None: await LanceDB().init() await Pool.init() TokenCalculator() - if Config().get_config().no_auth.enable: - await add_no_auth_user() + await add_defaut_admin_user() await clear_user_activity() # 运行 if __name__ == "__main__": diff --git a/apps/routers/mcp_service.py b/apps/routers/mcp_service.py index b238a5cd..6c63aff7 100644 --- a/apps/routers/mcp_service.py +++ b/apps/routers/mcp_service.py @@ -141,6 +141,8 @@ async def install_mcp_service( service_id: Annotated[str, Path(..., alias="serviceId", description="服务ID")], install: Annotated[bool, Query(..., description="是否安装")] = True, ) -> JSONResponse: + await _check_user_admin(user_sub) + try: await MCPServiceManager.install_mcpservice(user_sub, service_id, install) except Exception as e: @@ -173,9 +175,6 @@ async def get_service_detail( ) -> JSONResponse: """获取MCP服务详情""" # 检查用户权限 - if edit: - await _check_user_admin(user_sub) - # 获取MCP服务详情 try: data = await MCPServiceManager.get_mcp_service(service_id) -- Gitee