vercel / ai-chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
https://chat.vercel.ai
Other
5.53k stars 1.63k forks source link

How to stop stream? #290

Open benfiratkaya opened 3 months ago

benfiratkaya commented 3 months ago

Hey,

I want to stop an ongoing stream by pressing the button. I also want to prevent new messages from being entered while the stream continues. In older versions, it was easy to do this because useChat() was used, but now I have no idea how to do it.

athrael-soju commented 3 months ago

You'd have to implement a stop button in the UI that stops the stream before it's done here

This solution, although not the most refactored is actually much better than useChat.

benfiratkaya commented 3 months ago

You'd have to implement a stop button in the UI that stops the stream before it's done here

This solution, although not the most refactored is actually much better than useChat.

How can I use this on client side? Can you give an example?