From 6b37e0aef7d7e5615bd55ba8452e73435f1a9306 Mon Sep 17 00:00:00 2001 From: butubb <1422726308@qq.com> Date: Fri, 4 Sep 2026 13:02:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=5Fagent=5Fthread=20=E5=B1=80=E9=83=A8?= =?UTF-8?q?=20async=20def=20=5Frun=20=E9=81=AE=E8=94=BD=E5=85=A8=E5=B1=80?= =?UTF-8?q?=20dict=20=5Frun=E2=80=94=E2=80=94=E5=BC=82=E5=B8=B8=E5=88=86?= =?UTF-8?q?=E6=94=AF=20=5Frun["state"]=20=E6=8A=A5=20TypeError=20=E8=87=B4?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=B0=B8=E4=B8=8D=E6=9B=B4=E6=96=B0=EF=BC=9B?= =?UTF-8?q?=E6=94=B9=E5=90=8D=20=5Fexecute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/agent_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/agent_api.py b/web/agent_api.py index 9db6859..491f299 100644 --- a/web/agent_api.py +++ b/web/agent_api.py @@ -142,12 +142,12 @@ def _agent_thread(run_id, prompt, cfg): agent.s.default_serial = cfg.get("default_serial") or agent.s.default_serial agent.on_step = on_step - async def _run(): + async def _execute(): await agent._load_tools() return await agent.run(prompt, cfg.get("default_serial") or "") # 整体超时保护:模型/工具卡死时结束运行,避免单实例被永久占用 - answer = asyncio.run(asyncio.wait_for(_run(), timeout=600)) + answer = asyncio.run(asyncio.wait_for(_execute(), timeout=600)) with _lock: _run["state"] = "done" _run["answer"] = answer