From 7a93fc2df61ba5b578d4f01001f6da3d106a2c64 Mon Sep 17 00:00:00 2001 From: tqjason <37337136+tqjason@users.noreply.github.com> Date: Thu, 7 May 2026 20:10:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(autonomous):=20=E5=8A=A8=E6=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=87=AA=E4=B8=BB=E5=8C=96=E6=8F=90=E7=A4=BA=E8=AF=8D?= =?UTF-8?q?=EF=BC=8C=E6=98=8E=E7=A1=AE=E6=8C=87=E5=AE=9Asop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- launch.pyw | 9 ++++++++- reflect/autonomous.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/launch.pyw b/launch.pyw index e5b148f2..d1b954d3 100644 --- a/launch.pyw +++ b/launch.pyw @@ -73,7 +73,14 @@ def idle_monitor(): last_reply = get_last_reply_time() if now - last_reply > 1800: print('[Idle Monitor] Detected idle state, injecting task...') - inject("[AUTO]🤖 用户已经离开超过30分钟,作为自主智能体,请阅读自动化sop,执行自动任务。") + import importlib.util + spec = importlib.util.spec_from_file_location('autonomous', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'reflect', 'autonomous.py')) + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + try: + task = mod.check() + except Exception: + task = "[AUTO]用户已离开超过30分钟,作为自主智能体,请阅读 autonomous_operation_sop.md,执行自动任务" + inject(task) last_trigger_time = now except Exception as e: print(f'[Idle Monitor] Error: {e}') diff --git a/reflect/autonomous.py b/reflect/autonomous.py index 86a7d6e3..8549d839 100644 --- a/reflect/autonomous.py +++ b/reflect/autonomous.py @@ -3,4 +3,4 @@ ONCE = False def check(): - return "[AUTO]🤖 用户已经离开超过30分钟,作为自主智能体,请阅读自动化sop,执行自动任务。" \ No newline at end of file + return "[AUTO]用户已离开超过30分钟,作为自主智能体,请阅读 autonomous_operation_sop.md,执行自动任务" \ No newline at end of file