I tried a basic setup for NextJS + CopilotKit + Mastra ( as local )
then, I am using CopilotChat component ( see attachments )
In the NextJs APP, you will see I only input the following:
1st: "Hi 1"
2nd: "Hello 2"
3rd: What is the Weather in Cebu City? ( this is will execute a weather Tool )
and I found out that in the database ( PostgresDB ), it creates duplicate records in mastra_messages table