-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data part is not appended to message #4213
Comments
I meet the same issue. Any solutions about it ? |
@ifreeman6 |
|
@lgrammel |
On the client you need to accumulate consecutive assistant messages manually (unfortunately). It is related to mapping the messages back to the LLM format. When you do this accumulation, you would also get annotations from both msgs. I'll write this up somewhere, it is a somewhat annoying limitation that I plan to overcome with a new approach to AI SDK UI. |
Description
When using DataStreamWriter's writeData() to send custom data, the data part is not assigned the message as the operations when invoking writeMessageAnnotation() which annotations are assigned to message as expected.
In the current implementation the data is cached and returned as data for the whole chat, not accessible by message, although Message has a data field, but it's never assigned.
As you can see from the following code snippets.
https://github.com/vercel/ai/blob/main/packages/ui-utils/src/process-chat-response.ts#L222-L234
https://github.com/vercel/ai/blob/main/packages/ui-utils/src/types.ts#L47-L82
It would be better the data part is accessible by message like annotations.
Code example
No response
AI provider
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: