Next.js Discord

Discord Forum

Need fix for reloading useChat API with persists chat history

Unanswered
Audubon's Oriole posted this in #help-forum
Open in Discord
Audubon's OrioleOP
I am using useChat to implement chat-bot. I have some scenarios where I have to reload the chat after streaming is done.
probaby I can do this on
onFinish
function. but its removing last message from the messages (message history).
how can I handle this?

- I have tried setMessages inside the onFinish but its not have the latest message history.
- I have tried append as well but its not behaving properly. api goes into error state.

anyone has any clue?

5 Replies

Audubon's OrioleOP
@Arinji do you have any idea for this?
I havent worked with streaming yet xD
Audubon's OrioleOP
okay
Audubon's OrioleOP
anyone knows??