fix(wecom): close stream bubble on queued follow-up ack

This commit is contained in:
openbot-coder committed 2026-10-22 18:32:55 +08:00
1 parent 89aee65ddc
commit 719bb66627
2 files changed
+8 -1

No files matched your search

+6
View File
@@ -287,6 +287,12 @@ class WecomAibotChannel:
elif kind == "delta": elif kind == "delta":
self._stream_append(chat_id, str(payload.get("text", ""))) self._stream_append(chat_id, str(payload.get("text", "")))
elif kind == "status": elif kind == "status":
if payload.get("close_stream"):
# queued follow-up ack: the "正在处理…" bubble from this
# message's own ack would otherwise hang forever (a queued
# message never produces a final) — close it out instead.
self._stream_close(chat_id, str(payload.get("text", "")))
else:
self._stream_ensure(chat_id, str(payload.get("text", ""))) self._stream_ensure(chat_id, str(payload.get("text", "")))
elif kind == "tool_start": elif kind == "tool_start":
# show agent progress inside the stream bubble so long tool turns # show agent progress inside the stream bubble so long tool turns
+2 -1
View File
@@ -381,7 +381,8 @@ class SessionManager:
"text": text, "images": images or [], "files": files or [], "text": text, "images": images or [], "files": files or [],
}) })
key = f"{channel}:{chat_id}" key = f"{channel}:{chat_id}"
self._emit(key, "status", {"text": "已收到,将在当前回答结束后作为补充追加给 agent。"}) self._emit(key, "status", {"text": "已收到,将在当前回答结束后作为补充追加给 agent。",
"close_stream": True})
log.info(f"[{key}] follow-up queued mid-turn ({len(text)} chars)") log.info(f"[{key}] follow-up queued mid-turn ({len(text)} chars)")
return {"queued": True, "session_id": None, "agent": None} return {"queued": True, "session_id": None, "agent": None}
try: try: