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

useChat: add a clearError handler #4742

Open
alvarosevilla95 opened this issue Feb 6, 2025 · 0 comments
Open

useChat: add a clearError handler #4742

alvarosevilla95 opened this issue Feb 6, 2025 · 0 comments
Labels
ai/ui enhancement New feature or request

Comments

@alvarosevilla95
Copy link

alvarosevilla95 commented Feb 6, 2025

Feature Description

Be able to clear the error from useChat without calling reload or handleSubmit

Use Cases

I have a button to clear the chat window (which calls setMessages([])). However, if there was an error in the conversation, the error persists after clearing the messages. I'd like to be able to clear the error when I call my chatClear function, so the chat gets reset to a default state.

I can currently get around this by adding messages.length > 0 && error to display the error, but it would be cleaner if I could just clear it.

Additional context

No response

@alvarosevilla95 alvarosevilla95 added the enhancement New feature or request label Feb 6, 2025
@lgrammel lgrammel added the ai/ui label Feb 9, 2025
@lgrammel lgrammel reopened this Feb 11, 2025
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

2 participants