vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
9.78k stars 1.45k forks source link

Support for Tree-like Chat History with Branching #2929

Open xsayedmahmud opened 1 month ago

xsayedmahmud commented 1 month ago

Feature Description

I’d love to see API capabilities for easily implementing tree-like chat history, where I can edit any previously sent input or regenerate a response, creating a separate branch in the chat history. This feature is already available in major chatbots like Claude, ChatGPT, and even Vercel's own v0.

Use Case

When using chatbots like Claude, ChatGPT, or even Vercel's v0, I find the ability to create a new response branch one of the most useful features. It allows me to see if the new response performs better, and if not, I can easily return to the previous one and continue from there. The option to edit a previous input, which creates a separate branch with a new response, is also incredibly helpful. I've tried to build a similar tree-like chat history structure extending the useChat hook's capabilities, but I haven’t been able to find a working solution, and it’s becoming increasingly complex without a clear path forward.

Additional context

No response

sahas-si commented 2 weeks ago

Would love to have it

JatSh1804 commented 2 weeks ago

I am currently working on implementing branching in a personal project and managing db is quite challenging for that. Will love that feature. I Can also contribute in it.

sahas-si commented 1 week ago

Can you list the challenges too. Could be helpful for the team.

On Fri, Oct 4, 2024, 23:36 Jatin Sharma @.***> wrote:

I am currently working on implementing branching in a personal project and managing db is quite challenging for that. Will love that feature. I Can also contribute in it.

— Reply to this email directly, view it on GitHub https://github.com/vercel/ai/issues/2929#issuecomment-2394304167, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7RC7RPRD5WQ2INOZD6UNADZZ3KLXAVCNFSM6AAAAABN2433FGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUGMYDIMJWG4 . You are receiving this because you commented.Message ID: @.***>