Skip to content

Conversation

@KayTV
Copy link
Collaborator

@KayTV KayTV commented Nov 18, 2025

This pull request introduces a new mechanism for stopping chat sessions, specifically enhancing support for the "web automation" chat model. The main changes include adding a custom stop function in the chat component that sends a stopChat action to the backend, and updating the API route to handle this new action by forwarding the stop request to the Mastra backend.

Changes

  • Added a custom stop function in components/chat.tsx that, for the web-automation-model, sends a stopChat action to the backend with the relevant threadId and resourceId, in addition to aborting the chat stream locally.
  • Updated the destructuring in components/chat.tsx to rename the original stop function to originalStop, allowing for the custom logic to be added.
  • Modified app/(chat)/api/mastra-proxy/route.ts to handle requests with action: 'stopChat', forwarding them to the Mastra backend's /stop-chat endpoint and returning the backend's response.

Testing

Screenshot 2025-11-18 at 9 56 34 AM

@KayTV KayTV requested a review from fg-nava November 18, 2025 15:17
Copy link
Collaborator

@fg-nava fg-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but left a comment to review the other artifacts that our chatbot template made available.

},
});

// Custom stop function that sends stopChat action for web automation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to verify we've reviewed the other artifacts that are available in the AI Chatbot template (like the table artifact). I recall seeing stop controls there as well albeit they were not using App Router to send POSTs to a Mastra backend. Little doffeeent but there is a possibility we can adhere to the same pattern.

@fg-nava
Copy link
Collaborator

fg-nava commented Nov 19, 2025

Just realized you are probably wanting to hold on merging this until the pilot is over, right? Should we create a staging branch here? @KayTV

@KayTV KayTV merged commit 14738cd into labs-asp Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants