Skip to content

feat(ui): sent isAbort, isDisconnect, isError in useChat onFinish callback - #8364

Merged
lgrammel merged 21 commits into
mainfrom
lg/pV2vz92x
Sep 1, 2025
Merged

lgrammel merged 21 commits into
mainfrom
lg/pV2vz92x

Conversation

@lgrammel

@lgrammel lgrammel commented Aug 29, 2025 •

Copy link
Copy Markdown
Collaborator

Background

Chat.onFinish was called in many different cases and it is unclear how it related to finished assistant responses.

Summary

Add isAbort, isDisconnect, isError to Chat.onFinish callback.

Implemented in the same callback to prevent breaking behavior changes.

Manual Verification

  • run examples/next with build/start and force kill node server while request is in progress, check callback values in console
  • run examples/next and abort request, check callback values in console

Tasks

  • add chat implementation
  • unit test abort
  • unit test disconnect
  • reference documentation
  • guide documenation
  • changeset

Future Work

  • add cleanup of partial states that result from aborted streaming

Comment thread packages/ai/src/ui/chat.ts Resolved
@lgrammel lgrammel changed the title x feat(ui): sent isAbort, isDisconnect, isError in useChat onFinish callback Aug 30, 2025
Comment thread packages/ai/src/ui/chat.ts Resolved
@lgrammel
lgrammel marked this pull request as ready for review September 1, 2025 09:24

This branch was successfully deployed

1 active deployment
Preview — a5052e44 Deployed Sep 1, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants