Replies: 3 comments 1 reply
-
Also interested in ideas here - @edave did you end up landing on a solution? |
Beta Was this translation helpful? Give feedback.
-
Also hit this issue and I don't see any clear solution. I have similar code and useChat hook returns just one message while streaming multiple messages and merges all content/parts into that one message. |
Beta Was this translation helpful? Give feedback.
-
@rychlis I did not find a good existing answer to this. There is PR #2929 which adds support for branching, but it mostly stores the tree state client-side and still interacts with the Vercel AI SDK via a single-message mode. I've started a similar workaround to what you described, although I'm using
Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Based off the Next.js AI Chatbot I'm using several
streamText
calls (across multiple models/prompts/tools) within a single Next.js route.ts call.However, I cannot figure out how to chain the
streamText
responses in a way thatuseChat
will render multiple messages. For various reasons, I can't usemessage.parts
(unless there's something I don't understand aboutmessage.parts
being sub-messages).Background
My code looks something like:
useChat
receives and renders the streams from eachstreamText
, but into a single<Message>
What I've tried:
experimental_sendStart
andexperimental_sendFinish
flags tomergeIntoDataStream()
but it has not changed anything.<Message>
by manually injecting a new message type into the data stream, but this just gets wrapped as a generic data object:My Question
What should I be doing to have
useChat
correctly render several Messages from multiplestreamText
responses?Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions