-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat's .append_message_stream()
now returns an ExtendedTask
#1846
Conversation
@chat.on_user_submit
async def _(message: str):
stream = await chat.append_message_stream(stream_generator())
current_stream.set(stream)
current_stream: reactive.value[ExtendedTask[[], str] | None] = reactive.value(None) Could we wrap this bit up in a method, e.g. |
I went back and forth a bit on whether I wanted to add this since shinychat won't be able have an equivalent, but I think the end result (f625eba) is worth it. Note that I also decided to get the result of the stream, not the stream itself since >95% of the time you just want the result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I like the method interface 😄
This PR does 2 things:
get_latest_stream_result()
method for an easy way to access the final result of the stream when it completes..append_message_stream()
method now returns thereactive.extended_task
instance that it launches.chat-stream-result.mp4
TODO