Having multiple components that interact with the same chat #3339
hinderberg
started this conversation in
Ideas & Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have created a AI chat provider.
This package is a companion to Vercel's AI SDK, specifically useChat from ai/react.
The use-case for this is when you have multiple components that interact with the same chat. You can of course structure your components in a way that you only have one useChat call and pass props, but this is not always convenient.
useChat is designed so that data is shared when id and api match, but "setup" like generateId() and handlers like onFinish or onError are not. Also, it might feel awkward to ensure that only one useChat invocation specifies initialMessages.
Please feel free to copy, use, make PRs, etc:
Beta Was this translation helpful? Give feedback.
All reactions