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
I'm using the vercel ai chat template and I've implemented a custom ai provider.
Like shaded-blue mentioned, messages dissapear from my aistate.
sync function submitUserMessage(content: string) {
'use server'
const aiState = getMutableAIState<typeof AI>()
console.log('this is content', content)
// Retrieve the current messages before the update
const currentMessages = aiState.get().messages;
// Log the number of messages currently stored
console.log('Current number of messages before update:', currentMessages.length);
// Log each message in the current state
currentMessages.forEach((msg, index) => {
console.log(`Message ${index + 1}:`, msg);
});
When I have this in chat/lib/chat/actions.tsx - on each user message the current messages performs weird, showing different things like 0/1
Code example
sync function submitUserMessage(content: string) {
'use server'
const aiState = getMutableAIState<typeof AI>()
console.log('this is content', content)
// Retrieve the current messages before the update
const currentMessages = aiState.get().messages;
// Log the number of messages currently stored
console.log('Current number of messages before update:', currentMessages.length);
// Log each message in the current state
currentMessages.forEach((msg, index) => {
console.log(`Message ${index + 1}:`, msg);
});
Additional context
No response
The text was updated successfully, but these errors were encountered:
Description
So I'm having the same issue as this user: #1290
I'm using the vercel ai chat template and I've implemented a custom ai provider.
Like shaded-blue mentioned, messages dissapear from my aistate.
When I have this in chat/lib/chat/actions.tsx - on each user message the current messages performs weird, showing different things like 0/1
Code example
Additional context
No response
The text was updated successfully, but these errors were encountered: