Skip to main content

Module streaming

Module streaming 

Source
Expand description

In-flight streaming assistant preview.

Renders partial text via full MessageFormatter. Uses a thread-local parse cache to avoid re-running the markdown formatter on every token: while the streaming text grows by fewer than [STREAM_REPARSE_THRESHOLD] bytes since the last parse, the cached lines are reused as-is.

Functions§

push_streaming_preview
Append a streaming preview block when the app is actively receiving text.
reset_stream_parse_cache
Reset the streaming parse cache. Call when a new assistant turn begins (e.g. streaming_text was cleared) so a shrunken buffer doesn’t keep reusing stale parsed lines.