fix(webui): handle final stream image rewrites

This commit is contained in:
Xubin Ren
2026-05-24 19:43:20 +08:00
parent c9ff64fc0f
commit 8be258212e
6 changed files with 110 additions and 9 deletions
+4 -1
View File
@@ -1744,7 +1744,10 @@ class WebSocketChannel(BaseChannel):
stream_key = (chat_id, str(meta.get("_stream_id") or ""))
if meta.get("_stream_end"):
body: dict[str, Any] = {"event": "stream_end", "chat_id": chat_id}
full_text = "".join(self._stream_text_buffers.pop(stream_key, []))
buffered = self._stream_text_buffers.pop(stream_key, [])
if delta:
buffered.append(delta)
full_text = "".join(buffered)
rewritten = self._rewrite_local_markdown_images(full_text)
if rewritten != full_text:
body["text"] = rewritten