修复: 压缩摘要落可压缩区致循环卡死

This commit is contained in:
2026-06-24 23:26:48 +08:00
parent 953863af8e
commit 56a08fb5c1
3 changed files with 18 additions and 9 deletions

View File

@@ -982,14 +982,10 @@ pub(crate) async fn run_agentic_loop(
);
}
}
let ev = AiChatEvent::AiError {
error: format!("自动上下文压缩失败,已降级为普通裁剪: {}", e),
error_type: Some(ErrorType::Unknown),
conversation_id: Some(conv_id.clone()),
};
let _ = app_handle.emit("ai-chat-event", ev.clone());
// L3 emit 双写:tunnel subscriber(阶段2)透传 miniapp
let _ = app_handle.state::<AppState>().ai_event_bus.publish_event(ev);
// BUG-260624-05:压缩失败不发 AiError——前端 AiError case 无条件 setStreaming(false)
// 误判生成结束(后端 loop 实际继续),致"压缩后停止"。降级为 warn(上方 line 957 已有)
// + compress_old_messages 兜底释放 token + build_for_request 裁剪,loop 继续 stream_llm,
// 用户自然看到后续回复。压缩降级对用户透明(非致命错误,不该停流)。
}
}
}