-
Notifications
You must be signed in to change notification settings - Fork 325
fix: allow returning a non-streaming reponse from onChatMessage()
#761
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
Conversation
🦋 Changeset detectedLatest commit: 6ffbee0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9fe6f2a to
6e83bfe
Compare
6e83bfe to
1e8d4f7
Compare
onChatMessage()onChatMessage()
commit: |
- Add _broadcastTextEvent helper with discriminated union for type safety - Inject text-start/text-end events for plain text responses per AI SDK v5 protocol - Add id field to text-delta events (was missing) - Move isSSE check outside the loop - Add tests verifying event sequence and id consistency
pull common code into a helper file
threepointone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moves some common stuff into modules
threepointone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually hold up I think I want to refactor a bit more, I'll land it when happy
|
I was planning to submit a second PR refactoring the file after this, but if you prefer to do it yourself, sure |
|
let's land this and then work on the next one |
Currently, doing
from an AIChatAgent creates an error on the frontend, because doing so is only generating a
text-deltaevent, and not thetext-startandtext-endevents that should go in-between, according to https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol#text-start-part (from my understanding ?)This PR fixes it by adding these 2 events.