From bd338f7ad457bb8ff776e77c73a8d96bc8c75977 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Tue, 9 Jun 2026 11:41:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(runtime):=20=E4=BB=BB=E5=8A=A1=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E6=97=B6=E4=B8=8D=E5=86=8D=E6=B3=A8=E5=85=A5=E6=9D=83?= =?UTF-8?q?=E9=99=90/=E5=AE=A1=E6=A0=B8=E6=96=B9=E5=BC=8F=E9=80=9A?= =?UTF-8?q?=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 模型准备结束工作时,队列中残留的权限/审核方式变更通知不应再 插入对话。改用 consume_runtime_guidance_for_injection 保留 source 信息,过滤掉 source 为'权限变更/执行环境变更/notify'的消息。 --- server/chat_flow_task_main.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/chat_flow_task_main.py b/server/chat_flow_task_main.py index db12867..4cf1412 100644 --- a/server/chat_flow_task_main.py +++ b/server/chat_flow_task_main.py @@ -1699,10 +1699,25 @@ async def handle_task_with_sender( try: from .tasks import task_manager - pending_runtime_guidance_messages = task_manager.consume_runtime_guidance_messages( + raw_items = task_manager.consume_runtime_guidance_for_injection( username=username, task_id=client_sid, ) + # 权限/审核方式变更通知在任务完成时不应该触发新一轮工作, + # 只保留真正的引导消息(压缩续接等),丢弃权限/执行环境变更通知。 + runtime_skip_sources = {"权限变更", "执行环境变更", "notify"} + for item in (raw_items or []): + if isinstance(item, dict): + src = str(item.get("source") or "").strip().lower() + text = str(item.get("text") or "").strip() + if src in runtime_skip_sources: + continue + if text: + pending_runtime_guidance_messages.append(text) + else: + text = str(item or "").strip() + if text: + pending_runtime_guidance_messages.append(text) except Exception as exc: debug_log(f"[RuntimeGuidance] 读取剩余引导消息失败: {exc}") pending_runtime_guidance_messages = []