hoangsonww/AI-RAG-Assistant-Chatbot

Conversation Branching and Side-by-Side Branch Compare

Open

#37 opened on Feb 17, 2026

View on GitHub
 (0 comments) (0 reactions) (1 assignee)TypeScript (14 forks)auto 404
bugdocumentationenhancementgood first issuehelp wantedquestion

Repository metrics

Stars
 (43 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

Allow users to branch from any earlier message in a conversation, continue the branch as a separate thread, and compare outcomes side-by-side.

Problem

Current conversations are linear. If a user wants to explore an alternative prompt/path, they must overwrite context in the same thread or manually create a new conversation, losing traceability.

Proposed Solution

Add first-class branching to conversation history so users can fork from any message and explore alternatives without losing the original path.

Backend

  • Extend conversation/message metadata to support branching:
    • parentConversationId (optional)
    • branchedFromMessageId (optional)
    • branchLabel (optional)
  • Add endpoints:
    • POST /api/conversations/:id/branch (fork from a message)
    • GET /api/conversations/:id/branches (list child branches)
    • GET /api/conversations/:id/compare/:branchId (return normalized compare payload)
  • Preserve immutable source thread messages; branch starts with copied context up to fork point.

Frontend

  • Add “Branch from here” action on user/assistant messages.
  • Add branch switcher in sidebar (tree or grouped list).
  • Add branch compare view:
    • message count, latest response, citation count, last updated
    • optional side-by-side transcript panel

Docs

  • Update openapi.yaml for branch and compare endpoints.
  • Document conversation branching behavior in README.

Acceptance Criteria

  • User can fork from any message in an authenticated conversation.
  • New branch keeps context up to fork point and diverges independently afterward.
  • Original conversation remains unchanged.
  • Branches are discoverable and selectable in UI.
  • Compare endpoint/view shows key differences between base and branch.
  • Tests cover branching logic, auth boundaries, and compare payload correctness.

Out of Scope

  • Real-time multi-user collaborative editing.
  • Merge-back of branch content into base conversation.

Suggested Tasks

  • Add branch metadata to conversation model.
  • Implement branch create/list/compare endpoints.
  • Add UI branch action + branch navigation.
  • Add compare view and summary metrics.
  • Add integration tests + docs updates.

Contributor guide