ai-chatbot icon indicating copy to clipboard operation
ai-chatbot copied to clipboard

Discrepancy in Message Rendering Order During Streaming with New AI SDK Features

Open DavideGCosta opened this issue 10 months ago • 5 comments

I've observed that with the latest AI SDK features implemented in chat/route.ts, the rendering order of messages during streaming does not match the final rendered output after a page refresh. Specifically, during streaming:

  • Streaming Behavior: Only one aggregated message is displayed. As additional text is streamed, it pushes the tool component forward (i.e., the tool invocation appears to shift its position relative to the streamed text).

  • Post-Refresh Behavior: After refreshing the page, the message is split into two separate messages with the tool component rendered first, as expected.

Image

DavideGCosta avatar Feb 11 '25 22:02 DavideGCosta

same problem here, any solution ? Is the version with the bug located ?

Jaime5Alvarez avatar Feb 12 '25 16:02 Jaime5Alvarez

same problem here, any solution ? Is the version with the bug located ?

I have temporarily reverted to version 'ai': '4.0.11', until the issue is resolved.

Jaime5Alvarez avatar Feb 12 '25 17:02 Jaime5Alvarez

any fix to it?

rossanodr avatar Mar 05 '25 15:03 rossanodr

is someone one using the last ai version without this problem?

Jaime5Alvarez avatar Mar 06 '25 15:03 Jaime5Alvarez

t seems that messages are being merged somewhere in the frontend. In route.ts, the saved messages contain 2 or 3 items, but on the frontend, they are reduced to just one.

Zoltan3057 avatar Mar 21 '25 10:03 Zoltan3057

The issue is marked as completed, Where is the fix ?

Jaime5Alvarez avatar Apr 15 '25 10:04 Jaime5Alvarez