diff --git a/R/chat.R b/R/chat.R index 1de47bf..30ee2ab 100644 --- a/R/chat.R +++ b/R/chat.R @@ -76,7 +76,10 @@ chat_append <- function(id, response, session = getDefaultReactiveDomain()) { # Already a generator (sync or async) stream <- response } - chat_append_stream(id, stream, session = session) + do_stream <- function() { + chat_append_stream(id, stream, session = session) + } + session$onFlushed(do_stream) } #' Low-level function to append a message to a chat control