I am working on creating a playground to compare multiple chatbot instances using Vercel's AI SDK. Below is a simplified representation of our AI state structure:
// AI State Structure
type PlaygroundCompareAIState = {
chatbots: Map<string, PlaygroundCompareChatbotAIState>
}
type PlaygroundCompareChatbotAIState = {
history: MessageWithRole[]
}
As you can see, it is a map of instances, and each instance has its own history of messages array.
Problem:
When updating the history in our chat action (server side) using the following code:
Description
I am working on creating a playground to compare multiple chatbot instances using Vercel's AI SDK. Below is a simplified representation of our AI state structure:
As you can see, it is a map of instances, and each instance has its own history of messages array.
Problem:
When updating the history in our chat action (server side) using the following code:
The history is not updating at all and remains an empty array. Even when we log the new AI state before calling .done(), the history is still empty.
Expected Behavior:
The history array should be updated with the new messages, reflecting the latest conversation state for each chatbot instance.
Actual Behavior:
The history array remains empty, and no changes are reflected.
Thank you for your assistance!
Code example
No response
Additional context
No response