fix: artifact preview closes right after opening when a filter writes the reply (#31652)

Since 0.11.1, when a filter function wrote part of the reply before the model answered (for example some text and an HTML block), the artifact preview opened and then closed straight away. The page showed the filter text but was never sent it as part of the reply, so the model's first output overwrote it, the page briefly saw no HTML block and closed the preview. The filter text is now sent to the page before the model's output, so the preview stays open.

Fixes #31643
This commit is contained in:
Classic298 2026-09-30 19:02:27 +02:00 • committed by GitHub
parent f453324997
commit 1058444d74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4784,6 +4784,9 @@ async def streaming_chat_response_handler(response, ctx):
'content': [{'type': 'output_text', 'text': initial_content}],
}
]
if not continuing:
# the client needs this item before the first delta arrives
await event_emitter({'type': 'chat:completion', 'data': {'output': output}})
else:
output = []