Skip to content
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

[feature] provide a callback to useChat for when messages are completed #501

Open
dilanustek opened this issue Aug 23, 2023 · 2 comments
Open
Labels
ai/ui enhancement New feature or request

Comments

@dilanustek
Copy link

The useChat hook has an onFinish callback which fires when everything is completed. With the new experimental feature to stream additional data, the onFinish callback fires not after the tokens are completed but after any data is also done loading.

We need to be able to tell when the messages are completed so that we can show a loading state for the additional data that is being calculated based off of the message received. It would be nice to have an onCompleted callback added to the useChat hook on the client side. It may also look like a isMessageLoading added to the isLoading boolean to indicate the difference.

@MaxLeiter
Copy link
Member

I support an onCompletion to closer align the client API and server API. PR's welcome!

@ctate
Copy link
Contributor

ctate commented Sep 13, 2023

Great suggestion @dilanustek. I've started a draft PR for this here: #554

@lgrammel lgrammel added enhancement New feature or request ai/ui labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/ui enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants