Skip to content
Discussion options

You must be logged in to vote

Check if setMessages will fix your issue:

const { messages, setMessages } = useChat({ ... });

React.useEffect(() => {
  setMessages(initialMessages);
}, []);

I had an issue when messages were set directly like this: useChat({ messages: initialMessages });
Although it wasn't the same issue as you are having. In my case, initialMessages were cached and didn't change after the conversation. And once you switch between conversations, the messages (returned from useChat) were always the initialMessages without any new messages.

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@lgrammel
Comment options

@iywey
Comment options

@pavlo-tkhir
Comment options

Answer selected by iywey
@lgrammel
Comment options

@iywey
Comment options

@lgrammel
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants