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

Add onError handler to useAssistant hook #818

Merged
merged 9 commits into from
Jan 31, 2024

Conversation

mfts
Copy link
Contributor

@mfts mfts commented Dec 2, 2023

similar to useChat exposing an onError handler on the useAssistant hook.

const { status, messages, input, submitMessage, handleInputChange, error } =
    useAssistant({
      api: '/api/assistant',
      onError: err => { 
        console.error(err.message);
      },
    });

Copy link
Collaborator

@lgrammel lgrammel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great!

packages/core/react/use-assistant.ts Outdated Show resolved Hide resolved
@lgrammel
Copy link
Collaborator

lgrammel commented Dec 6, 2023

Build failure seems to be related to changes in PR.

@mfts
Copy link
Contributor Author

mfts commented Dec 27, 2023

Build failure seems to be related to changes in PR.

Sorry for the slow response. I created a proper Error and passed it in. That should fix the issue.

@mfts
Copy link
Contributor Author

mfts commented Dec 28, 2023

fixed the prettier format error

Copy link
Member

@MaxLeiter MaxLeiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mfts! Can you update the OptionTable in docs/pages/docs/api-reference/use-assistant.mdx?

@mfts
Copy link
Contributor Author

mfts commented Jan 31, 2024

Added documentation

@mfts mfts requested a review from MaxLeiter January 31, 2024 08:44
@MaxLeiter MaxLeiter merged commit 8542ae7 into vercel:main Jan 31, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants