diff --git a/apps/main.py b/apps/main.py index 99b7de0cd927f937abc95971cb878dd87e878abb..a7662062b27a6fb2e6184c9bdbec8e3d8a76bf6e 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 b238a5cda115e880d75ea91f6aa90a34a0360815..6c63aff77604cadac6059f80477b1ca029dc5023 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) diff --git a/apps/scheduler/executor/agent.py b/apps/scheduler/executor/agent.py index 5fd1688e946b63c96cb252f923de7c259d336cc0..dd84a690a01fc4ac3c18a3bb34e1e2d15a7a7f97 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 b85043eaac208b4b2b59c788336b034ed93733df..489efc74108dd1da24a2159d630e166a7a56b3ab 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(),