pub async fn fallback_stream<A: ChatAdapter + ?Sized>(
adapter: &A,
thread_id: &str,
text_stream: TextStream,
options: &StreamOptions,
) -> Result<SentMessage, ChatError>Expand description
Stream text progressively using a post-then-edit loop.
This is the default fallback streaming strategy for adapters that do not provide a native streaming mechanism:
- Post an initial placeholder message.
- Consume chunks from
text_stream, accumulating them. - Every
options.update_interval_msmilliseconds, edit the message with the accumulated text so far. - After the stream ends, perform a final edit with the complete text.