-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow submitting form without adding a message in useChat hook #167
Comments
Can you use |
@MaxLeiter unfortunately not, reload works differently. Instead of adding another assistant response, it removes the last assistant response and requests a new one. So you couldn't use it to make the hook request another assistant message without providing an additional user message. |
I think you can call |
@shuding I don't believe so, |
It seems like we need a new option in |
Maybe even more flexibility? I need this so I can modify the last |
Love the idea from @pomber, vote for this: reload({
transform: (messages) => newMessages
}) So we can have other options added in the future. PR welcome! |
Currently we do nothing if no text is input in the form - https://github.com/vercel-labs/ai/blob/fd69e9a5628d1cd21a7c4a36584b4c577e0cc0a6/packages/core/react/use-chat.ts#L253
But, submitting a new API request without adding a new user message is a good way to get the LLM to continue its previous response, for example if the user hit stop, or the previous response reached the token limit. This is how the OpenAI playground works.
The text was updated successfully, but these errors were encountered: