vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.34k stars 1.56k forks source link

When there is an ongoing AI streaming, switch the chat id, will cause data overwrite. #696

Open daimajia opened 1 year ago

daimajia commented 1 year ago

Description

When there is an ongoing AI streaming, switching the chat ID and causing a re-render of useChat can lead to some abnormal situations.

The data from the ongoing AI stream will overwrite the data of the newly switched chat ID.

Code example

<ParentComponent /> (useChat)
      <FirstChild  messages={messages} />
     <Button>Swtich Chat ID</Button>
<SecondChild /> 

Additional context

All client components, and all the data have been fully loaded on client. No response

stratospark commented 4 months ago

I am also running into this, it seems like a big limitation. I want to support multiple parallel chats, potentially using different providers.

medikornov commented 4 months ago

Also running into this issue, any news how to resolve, or if known issue, any ETA?