fix(web): support parallel sessions; fix lost/duplicate in-flight replies

This commit is contained in:
zhayujie
2026-06-08 15:36:48 +08:00
parent 26300a8d43
commit b7aa64279d
10 changed files with 266 additions and 33 deletions

View File

@@ -360,6 +360,13 @@ class WebChannel(ChatChannel):
):
logger.debug(f"Polling skipped duplicate file reply for session {session_id}")
return
# SSE-enabled requests already stream the text reply to the
# client. Do NOT also enqueue it for polling: if the user
# switched away mid-run, the queued copy would resurface as a
# duplicate bubble when they return and poll the session.
if reply.type == ReplyType.TEXT and context.get("on_event") is not None:
logger.debug(f"Polling skipped SSE text reply for session {session_id}")
return
response_data = {
"type": str(reply.type),
"content": content,