fix: conversation was still saved to the context after stop_event (#4345)

This commit is contained in:
Gao Jinzhe
2026-01-07 12:48:13 +08:00
committed by GitHub
parent 479284a8dd
commit eefa3f2f00
@@ -522,13 +522,15 @@ class InternalAgentSubStage(Stage):
):
yield
await self._save_to_history(
event,
req,
agent_runner.get_final_llm_resp(),
agent_runner.run_context.messages,
agent_runner.stats,
)
# 检查事件是否被停止,如果被停止则不保存历史记录
if not event.is_stopped():
await self._save_to_history(
event,
req,
agent_runner.get_final_llm_resp(),
agent_runner.run_context.messages,
agent_runner.stats,
)
# 异步处理 WebChat 特殊情况
if event.get_platform_name() == "webchat":