fix(runtime): 任务完成时不再注入权限/审核方式通知
模型准备结束工作时,队列中残留的权限/审核方式变更通知不应再 插入对话。改用 consume_runtime_guidance_for_injection 保留 source 信息,过滤掉 source 为'权限变更/执行环境变更/notify'的消息。
This commit is contained in:
parent
8d87068ba7
commit
bd338f7ad4
@ -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 = []
|
||||
|
||||
Loading…
Reference in New Issue
Block a user