Replies: 2 comments 2 replies
-
Your problem is you are putting the onFinish callback inside the "headers" key which is not correct.
|
Beta Was this translation helpful? Give feedback.
2 replies
-
I couldn't find a good solution, so I'll just go with this patch at the moment. const { messages, sendMessage, status } = useChat({
messages: initialMessages,
transport: new DefaultChatTransport({
api: "http://localhost:8000/api/chat"
}),
});
useEffect(() => {
chatStorage.saveChat(messages);
}, [messages]); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to store chat messages locally using IndexedDB. The AI SDK provides
onFinish
in/api/chat -> streamText
, but that is server-based. I need to store messages locally. I tried usingonFinish
in useChat(), but it didn't trigger the console log.Here is my code:
Has anyone successfully used onFinish on the client side to store messages locally? Any insights or solutions would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions