ai
ai copied to clipboard
Streaming text inside `streamUI` isn't working in `next@15` & `react@19`
Description
The text streaming in the text()
function no longer works in the ai-chatbot example and I can't find any updated code for getting this feature to work?
To reproduce:
-
Clone the ai-chat example: https://github.com/vercel/ai-chatbot/tree/main
-
Add required env variables
-
install dependencies
-
Run
dev
and provide a prompt that doesn't trigger atool
so the AI responds with text. -
Notice that the text streams in word by word fine
-
Update next, ai, @ai-sdk/openai, react & react-dom to the latest versions.
-
run
dev
and give the same prompt. Notice that the text no longer streams in, but the response takes longer than before and then the entire message comes back at once.
I tested on the latest versions as of today:
"@ai-sdk/openai": "0.0.40",
"next": "15.0.0-canary.91",
"react": "19.0.0-rc-941e1b4a-20240729",
"react-dom": "19.0.0-rc-941e1b4a-20240729",
When downgrading to next@14 and react@18 again the text streaming example works fine.
The text streaming is a big improvement to chat UX when the responses are slow to complete.
Code example
No response
Additional context
It would be great if there were docs that covers this scenario for Vercel AI SDK. I imagine most people that want to use streamUI
will also use the text
fallback and want the text to be streaming.