Yonom / assistant-ui

React Components for AI Chat 💬 🚀
https://www.assistant-ui.com
MIT License
542 stars 38 forks source link

refactor: Add reset functionality to `LocalThreadRuntime` and `MessageRepository` #679

Closed Rajaniraiyn closed 3 weeks ago

Rajaniraiyn commented 4 weeks ago

adds reset method to messages repository which helps in switching chats

vercel[bot] commented 4 weeks ago

@Rajaniraiyn is attempting to deploy a commit to the Simon Farshid's projects Team on Vercel.

A member of the Team first needs to authorize it.

Yonom commented 4 weeks ago

Thanks a lot! I am adding a few new features to the thread (image upload, file upload, voice mode). These need some extra handling regarding the reset - so I will merge this once those features are ready

In the meantime, you can get the equivalent of a reset by calling useSwitchToNewThread(): https://www.assistant-ui.com/docs/advanced/API#useswitchtonewthread

Yonom commented 3 weeks ago

@Rajaniraiyn I switched to a slightly different method - which entirely swaps the thread runtime. I added the ability to re-specify the intialMessages to fix #701

Yonom commented 3 weeks ago

Thank you so much for this idea and initial implementation!!