Skip to content

Using the same id with useChat is not hooking into the existing session #3266

Closed
@Godrules500

Description

@Godrules500

Description

It could be that I am misunderstanding the documentation, but

in Component 1 I have
const {messages} = useChat({id:'myChatId', initialMessages})
and in component 2 (a child component in this case) I have:
const {messages} = useChat({id:'myChatId'})
messages however is empty and I cannot actually hook into the existing chat session or its data.

Am I misunderstanding this and could I get some guidance please. If I don't have to pass in handleInputChange, input, setInput, messages, setMessages, etc everywhere I want to use it, I'd prefer to do that.

Code example

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions