Closed JoseAngelChepo closed 1 month ago
@JoseAngelChepo Great find. If you like, you can post this in https://github.com/vercel/ai-chatbot/issues/325#issuecomment-2094917193 to consolidate comments under one post.
Honestly, removing system messages in this update left me baffled, a little bit. It just wasn't necessary. Moreover, there is not a single template using ai-rsc, or genUI that isn't riddled with bugs. I have a local clone that resolves most of the critical issues, but I'm finding more bugs that I have the time to open and there isn't much support in resolving them.
Perhaps it's best to let things be for now, until a new template is written from scratch.
The last update "streamUI instead of render #324" not allow messages with "role: system" between conversation (only at start) with new prompt param system.
The "problem" is: The functions also uses messages with "role: system" to register the actions or events from the user in the context conversation.
The error
Cannot destructure property 'role' error
is consequence of the function below that return undefined for "role: system"This function is inside of dependency "ai": "^3.1.1"
I tested in compiled module inside
node_modules/ai/rsc/dist/rsc-server.msj
function convertToLanguageModelPrompt by addingResult:
This works but the correction must be made in the repository of the dependency "ai": "^3.1.1".
And this depends on whether it is considered good practice to send system messages inside of the conversation to save new context (user events)