Skip to content

msaleme/ChatMeld-Ollama

Repository files navigation

ChatMeld with Ollama Support

A privacy-focused, client-side multi-LLM chat application with support for local models via Ollama. This fork extends the original ChatMeld with the ability to run AI conversations entirely on your machine using open-source models like Qwen, Llama, and Mistral.

Features

  • Local Model Support: Run conversations using Ollama with models like Qwen 2.5, Llama 3.2, Mistral, and more
  • Multi-Model Chat: Chat with different AI models simultaneously
  • AI-to-AI Conversations: Watch AI models interact with each other
  • Customizable AI Personalities: Create agents with specific traits and behaviors
  • Full Conversation Control: Pause, rewind, edit, and remove AI responses
  • Privacy-First: All data stored locally in your browser using IndexedDB
  • No Server Required: Direct API integration - your keys never leave your browser
  • Hybrid Mode: Mix local Ollama models with cloud providers (OpenAI, Google AI)

Prerequisites

For Local Models (Ollama)

  1. Install Ollama

    # macOS
    brew install ollama
    
    # Linux
    curl -fsSL https://ollama.com/install.sh | sh
    
    # Windows - Download from https://ollama.com/download
  2. Start Ollama Service

    # macOS
    brew services start ollama
    
    # Linux/macOS alternative
    ollama serve
  3. Pull Models

    # Recommended starter models
    ollama pull qwen2.5:7b      # 4.7GB - Great general purpose
    ollama pull llama3.2        # 2.0GB - Fast and capable
    
    # Optional larger/specialized models
    ollama pull qwen2.5:14b     # Better quality, requires more RAM
    ollama pull mistral         # Good for creative tasks
    ollama pull codellama       # Optimized for code generation

For Development

  • Node.js v18 or higher
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/ChatMeld-Ollama.git
cd ChatMeld-Ollama

# Install dependencies
npm install

# Start development server
npm run dev

Open http://localhost:5173 in your browser.

Configuration

Setting Up Ollama (Local Models)

  1. Navigate to Settings in the app
  2. Scroll to Ollama (Local Models) section
  3. Check Enable Ollama
  4. The default URL http://localhost:11434 works for standard setups
  5. For remote Ollama instances, update the Base URL accordingly

Setting Up Cloud Providers (Optional)

  • OpenAI: Settings → API Keys → OpenAI API Key
  • Google AI Studio: Settings → API Keys → Google AI Studio API Key

Usage

Creating a Conversation

  1. Click New Conversation from the dashboard
  2. Select 2-4 agents (each can use a different model)
  3. Give your conversation a title
  4. Click Start Chat

Creating Custom Agents

  1. Go to AgentsMy Custom Agents
  2. Click Create New Agent
  3. Configure:
    • Name: Display name for the agent
    • Description: Personality and role description (used as system prompt context)
    • Default Model: Select from available models
    • Temperature: Controls creativity (0.0 = deterministic, 1.0 = creative)
  4. Click Save

Conversation Controls

Control Description
Auto-advance Agents automatically take turns responding
Advance one message Manually trigger the next response
Click agent avatar Force that agent to speak next
Edit message Modify any message in the conversation
Restart Clear conversation and start fresh

Supported Models

Ollama (Local)

Model Size Use Case
qwen2.5:7b 4.7GB General purpose, balanced quality/speed
qwen2.5:14b 9GB Higher quality, requires 16GB+ RAM
qwen2.5:32b 20GB Best quality, requires 32GB+ RAM
llama3.2 2.0GB Fast responses, efficient
mistral 4.1GB Creative writing, roleplay
codellama 3.8GB Code generation and review

To add more models, pull them with Ollama and update src/lib/llm-providers.ts.

Cloud Providers

  • OpenAI: GPT-4o, GPT-4o-mini, GPT-4.1 series
  • Google AI: Gemini 2.5 Flash, Gemini 2.5 Pro

Architecture

┌─────────────────────────────────────────────────────┐
│                    Browser                          │
│  ┌───────────────────────────────────────────────┐  │
│  │              ChatMeld Frontend                │  │
│  │  ┌─────────┐  ┌─────────┐  ┌──────────────┐  │  │
│  │  │ React   │  │ Zustand │  │   Dexie.js   │  │  │
│  │  │   UI    │  │  State  │  │  (IndexedDB) │  │  │
│  │  └────┬────┘  └────┬────┘  └──────────────┘  │  │
│  │       │            │                          │  │
│  │  ┌────▼────────────▼────┐                    │  │
│  │  │   LLM Provider Layer │                    │  │
│  │  └──────────┬───────────┘                    │  │
│  └─────────────┼─────────────────────────────────┘  │
└────────────────┼────────────────────────────────────┘
                 │
    ┌────────────┼────────────┐
    │            │            │
    ▼            ▼            ▼
┌────────┐  ┌────────┐  ┌──────────┐
│ Ollama │  │ OpenAI │  │ Google   │
│ (Local)│  │  API   │  │ AI API   │
└────────┘  └────────┘  └──────────┘

Security Considerations

Data Privacy

  • All data is stored locally in your browser's IndexedDB
  • API keys are stored locally and only sent to their respective API providers
  • No telemetry or tracking - no external requests except to configured LLM providers
  • Ollama runs locally - conversations with local models never leave your machine

Best Practices

  1. Never commit API keys to version control
  2. Use the .gitignore - it already excludes .env files
  3. Clear browser data when using shared computers
  4. Review network settings if exposing Ollama to other machines

Network Security (Ollama)

  • Default binding: localhost:11434 (not network-exposed)
  • Development server proxies requests to avoid CORS issues
  • For production with remote Ollama, configure CORS:
    OLLAMA_ORIGINS="https://yourdomain.com" ollama serve

Development

Project Structure

src/
├── components/           # React UI components
│   └── sidebar/          # Chat sidebar components
├── db/                   # Dexie.js database configuration
├── hooks/                # Custom React hooks
│   └── useChatConductor.ts   # AI conversation orchestration
├── lib/                  # Core business logic
│   ├── llm-providers.ts  # LLM provider configurations
│   ├── llm-api.ts        # Unified API abstraction
│   ├── chat-logic.ts     # Turn-taking and response logic
│   └── prompts.ts        # System prompt templates
├── store/                # Zustand state management
├── types/                # TypeScript type definitions
└── views/                # Page-level components

Adding New Ollama Models

  1. Pull the model: ollama pull model-name:tag
  2. Edit src/lib/llm-providers.ts:
{
  id: 'ollama',
  apiKeyName: 'ollamaEnabled',
  defaultModel: 'qwen2.5:7b',
  models: [
    { id: 'qwen2.5:7b', label: 'Qwen 2.5 7B' },
    { id: 'llama3.2:latest', label: 'Llama 3.2' },
    // Add your model:
    { id: 'model-name:tag', label: 'Display Name' },
  ],
  call: ollamaCall,
},

Build Commands

npm run dev       # Start development server
npm run build     # Build for production (outputs to docs/)
npm run preview   # Preview production build

Troubleshooting

Ollama Not Responding

# Check if Ollama is running
curl http://localhost:11434/api/tags

# Test a model directly
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen2.5:7b", "messages": [{"role": "user", "content": "Hi"}]}'

# Restart Ollama
brew services restart ollama  # macOS
systemctl restart ollama      # Linux with systemd

Models Not Appearing in App

  1. Verify Ollama is enabled in Settings
  2. Check installed models: ollama list
  3. Ensure model IDs in llm-providers.ts match exactly (including tags)
  4. Clear browser cache and refresh

Conversation Not Advancing

  1. Open browser DevTools (F12) → Console tab
  2. Look for [Conductor] or [LLM API] log messages
  3. Check for error messages about missing API keys or failed requests

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes following the existing code style
  4. Test thoroughly with both Ollama and cloud providers
  5. Commit with clear messages: git commit -m 'Add amazing feature'
  6. Push to your fork: git push origin feature/amazing-feature
  7. Open a Pull Request

Credits

  • Original ChatMeld by Balazs Piller
  • Ollama integration by this fork
  • Built with React, Vite, Zustand, Dexie.js, and Tailwind CSS

License

MIT License - see LICENSE for details.


This is a fork of ChatMeld with added Ollama support for local model inference. For the original project, visit balazspiller/ChatMeld.

About

Privacy-focused multi-LLM chat app with Ollama support for local AI models (Qwen, Llama, Mistral). Fork of ChatMeld.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages