fix(websocket): always send text in stream_end when stream had content

The channel manager coalesces consecutive _stream_delta messages and
forwards a single merged message with _stream_end=True. In that path
no individual delta events ever reach the WebUI client, so the
stream_end frame is the only carrier of the text. The previous guard
only attached text when media-URL rewriting changed the string, which
silently dropped entire turns of plain-text output whenever the
agent generated tokens faster than the queue drained.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Syoc 2026-06-09 21:24:53 +02:00 committed by Xubin Ren
parent 9c492143b4
commit 4dd5b62f11

View File

@ -1063,7 +1063,7 @@ class WebSocketChannel(BaseChannel):
buffered.append(delta)
full_text = "".join(buffered)
rewritten = self._media.rewrite_local_markdown_images(full_text)
if rewritten != full_text:
if full_text:
body["text"] = rewritten
else:
body = {