Any tips on AIState? Seem to be doing a lot of fighting trying to get it to show what I'm expecting. #1290
Unanswered
shaded-blue
asked this question in
Help
Replies: 2 comments 1 reply
-
+1 having this exact problem |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've mentioned it here: #1509 - this is the 2nd weird error I've encountered with their ai chat template. You are not going crazy, my guess is they are moving fast, perhaps too fast, to try and be the dominate ai sdk platform and stuff is breaking |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To be clear, I'm not exactly new to this, but I feel like I have completely lost it since trying to integrate this AI SDK into my codebase / project, and part of my brain is just no longer functioning.
I seem to have absolutely no understanding of how this AIState is being updated.
For example, in my sendMessage server action, I am setting the initial message with update:
And I am using the same render function they are for the response, which uses done to add the response:
I log aiState.get() through the mutation steps and see exactly what I expect, which is the new message after the update, and both at the done.
Similarly, if I log getAIState() in messageSave, which gets run after from the unstable_onSetAIState, I can see both messages.
When I send a follow-up message, the very first message I sent is gone from AIState, seemingly in between the last step of unstable_onSetAIState, and the absolute very start of the sendMessage action.
All follow up messages are successfully stored in the AIState.
Another oddity, is that when logged from the client, useAIState's state seems to look completely different from that on the server.
I've read through the rather terse docs many times, but again, I feel I've just found myself in some kind of rut here and my brain absolutely cannot seem to reconcile whatever is missing in my understanding, but I must be missing something, because for a tool that claims to streamline interaction with LLM's, I must say I've found this significantly more difficult to understand and implement than rolling an entire solution myself, even before getting to the UI part, which is the entire reason I started this attempt at a migration.
All advice is greatly appreciated, and thank you for your time. Sorry for the bit of a rant, this has really gotten to me. Lol.
Beta Was this translation helpful? Give feedback.
All reactions