Skip to content
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

fix (ai/ui): keep last message in useChat on error #2262

Merged
merged 20 commits into from
Jul 15, 2024
Merged

fix (ai/ui): keep last message in useChat on error #2262

merged 20 commits into from
Jul 15, 2024

Conversation

lgrammel
Copy link
Collaborator

@lgrammel lgrammel commented Jul 12, 2024

Summary

Introduces a flag keepLastMessageOnError on useChat (default: false). This flags enables the new error handling behavior that keeps the last message. The behavior is is intended to be the default in the next major release (and the flag will be removed).

Background

We currently remove the last message from a chat when an error occurs. This makes retries and error handling much harder than it needs be and forces our users to manage the last message outside of the AI SDK.

Tasks

  • implementation
    • react
    • solid
    • vue
    • svelte (x2)
  • examples
    • react
    • solid
    • vue
    • svelte
  • documentation
    • add to reference docs
    • add to error handling guide (ui)
    • add proper full example for useChat
  • changeset

@AntzyMo
Copy link
Contributor

AntzyMo commented Jul 13, 2024

#2269

AntzyMo and others added 2 commits July 15, 2024 09:14
Co-authored-by: Lars Grammel <lars.grammel@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@lgrammel lgrammel marked this pull request as ready for review July 15, 2024 09:02
@lgrammel lgrammel merged commit a6cb2c8 into main Jul 15, 2024
8 checks passed
@lgrammel lgrammel deleted the lg/2086 branch July 15, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants