Skip to content

keshavnath/chat-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ChatBranch - Git for Chat

Transform your AI conversations with visual branching - like Git, but for chat. Start a conversation, then branch off at any point to explore different directions without losing context.

What is ChatBranch?

ChatBranch lets you have non-linear conversations with AI models. Instead of a single thread of messages, you can branch your conversation at any point to explore alternative topics, approaches, or solutions. Think of it as version control for your thoughts and discussions.

Key Concepts

🌳 Branching: Create new conversation paths from any message without losing your original thread. Perfect for exploring "what if" scenarios or diving deeper into specific topics.

🎯 Navigation: Built-in undo/redo system lets you navigate between different conversation states and branches effortlessly. Use the arrow buttons to step back and forward through your conversation history.

πŸ‘οΈ Visualization: Switch between Chat view (traditional message interface) and Tree view (visual diagram) to see the full structure of your branched conversations.

πŸ€– Multi-Model Support: Seamlessly switch between different AI models (GPT-3.5, GPT-4, Claude) mid-conversation to compare responses or leverage different AI strengths.

Core Features

Visual Conversation Branching

  • Right-click any message to create a new branch from that point
  • Name your branches with descriptive labels for easy organization
  • Branch colors help distinguish different conversation paths in tree view
  • Independent contexts - each branch maintains its own conversation history

Intelligent Navigation

  • Undo/Redo system for navigating between conversation states
  • Branch switching to jump between different conversation paths
  • Message selection to resume conversations from specific points
  • Conversation persistence - all your work is automatically saved

Tree Visualization

  • Interactive tree diagram showing your entire conversation structure
  • Click any message in the tree to jump to that point
  • Visual branch relationships to understand conversation flow
  • Zoom and pan to navigate large conversation trees

Multi-Model Integration

  • Switch AI models anytime during conversations
  • Compare responses by branching and trying different models
  • Model-specific capabilities - use the right AI for the right task
  • Seamless transitions between different AI providers

Demo Mode

  • Test without API costs using built-in dummy responses
  • Explore all features before connecting your own API keys
  • Perfect for learning the branching workflow
  • No setup required - works out of the box

How It Works

Starting a Conversation

  1. Create a new conversation with a descriptive title
  2. Type your message and send to start the conversation
  3. Choose your AI model from the dropdown (GPT, Claude, etc.)
  4. Get AI response and continue the conversation normally

Creating Branches

  1. Right-click any message (yours or the AI's) in the conversation
  2. Select "Branch from here" from the context menu
  3. Name your branch (e.g., "Alternative approach", "Deep dive")
  4. Continue the conversation in this new direction
  5. Switch between branches using the branch selector

Navigating Your Conversation

  • Use undo/redo arrows (β—€ β–Ά) to step through conversation history
  • Switch to Tree view to see the visual structure
  • Click messages in tree view to jump to specific points
  • Use branch selector to switch between conversation paths

Managing Conversations

  • Conversation sidebar shows all your saved conversations
  • Delete branches you no longer need (except main branch)
  • Rename conversations by clicking the edit icon
  • Automatic saving preserves all your work

Use Cases

Research and Exploration

  • Compare different approaches to solving a problem
  • Explore multiple angles of a complex topic
  • Deep dive into specifics without losing the main thread
  • Document your thinking process with clear visual structure

Writing and Brainstorming

  • Draft multiple versions of content in parallel branches
  • Explore different writing styles or tones
  • Develop ideas incrementally while preserving alternatives
  • Collaborate with AI on creative projects

Problem Solving

  • Try different solution strategies in separate branches
  • Compare AI model responses to the same problem
  • Build on partial solutions without losing progress
  • Document decision-making process with clear paths

Learning and Teaching

  • Explore concepts from multiple perspectives
  • Create study guides with branching topics
  • Compare different explanations of complex subjects
  • Build knowledge trees that grow with your understanding

Technical Overview

ChatBranch consists of a React frontend for the user interface and a FastAPI backend for data management and AI integration. All conversations are stored in PostgreSQL with a tree structure that preserves the branching relationships between messages.

Architecture Highlights

  • Tree-structured storage preserves conversation branching relationships
  • Real-time updates keep the interface synchronized with your actions
  • Efficient navigation with intelligent state management
  • Scalable design ready for multi-user deployment

Browser-Like Navigation

  • URL-based routing for conversations - each conversation has its own URL
  • Browser back/forward works for switching between conversations
  • Within-conversation navigation uses the built-in undo/redo system
  • Bookmarkable conversations - share specific conversation URLs

Getting Started

ChatBranch is currently in development mode with full LLM integration coming soon. You can explore all features using the built-in demo mode.

Demo Mode

  • No API keys required - test all features immediately
  • Realistic dummy responses simulate actual AI conversations
  • Full functionality including branching, navigation, and visualization
  • Perfect for learning how branching conversations work

Coming Soon: Full LLM Integration

  • Connect your own API keys for OpenAI, Anthropic, and other providers
  • Real AI responses instead of demo content
  • Advanced model switching with provider-specific features
  • Usage tracking and conversation analytics

Installation

See QUICKSTART.md for detailed developer setup instructions.

Quick overview:

  1. Clone the repository and install dependencies
  2. Set up PostgreSQL database using provided scripts
  3. Run backend and frontend in separate terminals
  4. Open browser to http://localhost:3000

Fixing missing is_active columns

If you see errors about missing branches.is_active or messages.is_active (for example when upgrading branches or running the frontend), you can run the provided helper to add those columns safely:

From the repo root (uses the same DATABASE_URL your backend is configured with):

PowerShell (venv):

& "./venv/Scripts/Activate.ps1"
python backend\database\ensure_is_active_columns.py

Or, inside the running backend container:

docker compose exec backend python backend/database/ensure_is_active_columns.py

This is an idempotent helper intended as a stop-gap; for production use create a proper Alembic migration.

The application runs locally on your machine with full data privacy and control.

Support and Development

ChatBranch is actively developed with new features being added regularly. The focus is on creating the most intuitive and powerful tool for branching conversations with AI.

Current Status

  • βœ… Visual branching with right-click context menus
  • βœ… Tree visualization with interactive diagrams
  • βœ… Navigation system with undo/redo functionality
  • βœ… Multi-model support framework ready
  • βœ… Demo mode for testing without API costs
  • πŸ”„ LLM integration coming soon
  • πŸ”„ Multi-user support planned for future release

Contributing

The codebase is designed for extensibility and contribution. Key areas for development include additional AI model integrations, advanced visualization features, and collaborative conversation tools.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published