You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If steamText encounters an error, messages of useChat will lose the messages sent by user due to error reporting. For example:
constmessages=[{"role": "user","content": "hi"},{"role": "assistant","content": "hello"},{"role": "user","content": "who are you?"}]
If you send the last item of the messages array and an error is reported, the message who are you will be displayed. I think this is wrong and it looks like a bug.
So my idea is to restore to the previous message when an error is reported, including user
Yep - This one gives the developer a little more work to do with the out of the box behavior.
Consider:
Start a new chat
Enter question
System errors
Wipes UI including users' question
The current workarounds rely on the developer maintaining a second shadow state of the AI state in order to provide better UX to their users.
In most cases, although the error message is most likely generic and related to the server itself, the user probably expects an error message in place of the streaming message coming in or appended to it with the option to reload or trigger a new message.
Description
If
steamText
encounters an error,messages
ofuseChat
will lose the messages sent byuser
due to error reporting. For example:If you send the last item of the
messages
array and an error is reported, the messagewho are you
will be displayed. I think this is wrong and it looks like abug
.So my idea is to restore to the previous message when an error is reported, including
user
Code example
ai/packages/vue/src/use-chat.ts
Line 128 in a92523c
Taking
vue
as an example,previousMessages
should be changed toconst previousMessages = messagesSnapshot
, which can ensure the latest message recordsAdditional context
No response
The text was updated successfully, but these errors were encountered: