A production-ready AI chat platform built with Phoenix LiveView, featuring intelligent solution management, multi-modal conversations, and real-time streaming.
ElixirBear is a sophisticated AI chat application that goes beyond simple conversations. It intelligently extracts, organizes, and retrieves code solutions from your chat history, making it a powerful tool for developers who want to build a personal knowledge base while interacting with AI models.
Transform your AI conversations into a powerful development tool:
- π€ Dual AI Provider Support: Seamlessly switch between OpenAI's GPT models and local Ollama models
- πΌοΈ Multi-Modal Conversations: Attach images, audio files, and code files directly to your messages
- β‘ Real-Time Streaming: Experience instant, token-by-token response streaming powered by Phoenix LiveView
- π Smart Conversation Management: Organize multiple conversation threads with easy navigation and search
- π¨ Customizable Interface: Personalize your workspace with custom background images and themes
- π Learning Mode: Built-in copy blocker that prevents copying conversation text to encourage active learning
- π§ Prompt Orchestrator: Automatically selects specialized system prompts based on conversation context
The standout feature that sets ElixirBear apart:
- π Automatic Solution Extraction: Let AI identify and extract valuable code solutions from your conversations automatically
- π·οΈ Smart Tagging System: Organize solutions with custom tags for lightning-fast retrieval
- π― Intelligent Solution Router: AI-powered matching system that suggests relevant solutions as you chat
- π Code Block Support: Store multiple code blocks per solution with full syntax highlighting
- π Reusability at Scale: Build your personal library of battle-tested solutions
Powerful tools designed to improve your learning experience:
-
π Copy Blocker (Learning Mode): Force active learning by preventing text copying
- Hides all copy buttons from code blocks
- Blocks text selection across conversation messages
- Encourages manual typing for better retention
- Toggleable on/off in Settings (enabled by default)
-
π― Prompt Orchestrator: Context-aware system prompt selection
- Automatically analyzes your questions to detect programming languages and frameworks
- Selects specialized system prompts based on detected context
- Supports hierarchical categories (e.g.,
python/djangoβpythonβdefault) - Define custom prompts using simple JSON configuration
- Uses local or cloud LLM for intelligent routing
Example orchestrator configuration:
{ "python": "You are a Python expert...", "python/django": "You are a Django framework specialist...", "elixir": "You are an Elixir expert...", "elixir/phoenix": "You are a Phoenix framework expert...", "default": "You are a helpful programming assistant..." }
Work with virtually any file type in your conversations:
| Category | Supported Formats |
|---|---|
| Images | .jpg, .jpeg, .png, .gif, .webp |
| Audio | .mp3, .mpga, .m4a, .wav |
| Elixir | .ex, .exs, .heex, .eex, .leex |
| Web | .js, .jsx, .ts, .tsx, .css, .scss, .html |
| Config | .json, .xml, .yaml, .yml, .toml |
| Languages | .py, .rb, .java, .go, .rs, .c, .cpp, .sh and more |
| Documentation | .txt, .md |
Real-time Architecture
- Built on Phoenix PubSub for instant message delivery
- LiveView integration eliminates the need for separate frontend framework
- WebSocket-based streaming for token-by-token AI responses
Smart Background Processing
- Asynchronous conversation processing with dedicated workers
- Non-blocking solution extraction and routing
- Efficient handling of file uploads and processing
Developer-Friendly Design
- Clean separation of concerns with domain-driven design
- Comprehensive test coverage
- Pre-commit hooks for code quality
- SQLite for simple deployment and portability
- Backend: Elixir 1.15+ with Phoenix Framework 1.8
- Frontend: Phoenix LiveView 1.1 with TailwindCSS
- Database: SQLite (via Ecto SQLite3)
- AI Integration: OpenAI API & Ollama support
- Real-time: Phoenix PubSub for live updates
- Assets: esbuild & Tailwind CSS
- Elixir 1.15 or later
- Erlang/OTP 24 or later
- Node.js (for asset compilation)
- SQLite3
- Clone the repository:
git clone https://github.com/RobGilto/elixir_bear.git
cd elixir_bear- Install dependencies and set up the database:
mix setupThis will:
- Install Elixir dependencies
- Create and migrate the database
- Install and build assets
- Configure your AI provider settings:
- For OpenAI: Set your API key in the Settings page after starting the server
- For Ollama: Ensure Ollama is running locally and configure the endpoint in Settings
Start the Phoenix server:
mix phx.serverOr start it inside IEx for interactive debugging:
iex -S mix phx.serverVisit localhost:4000 in your browser.
-
Configure AI Provider - Navigate to Settings (
/settings):- Add your OpenAI API key for GPT models, or
- Configure Ollama endpoint for local models (e.g.,
http://localhost:11434)
-
Configure Learning Features (Optional):
- Copy Blocker: Enabled by default. Toggle off if you prefer to copy code freely
- Prompt Orchestrator: Define specialized system prompts for different programming contexts
-
Enable Smart Features (Optional):
- Enable automatic solution extraction
- Configure the solution router for AI-powered suggestions
- Set solution router threshold for match confidence
-
Start Chatting - Create a new conversation and start building your knowledge base!
- Starting a new conversation
- Asking a coding question
- Getting a solution with code blocks
- Solution being automatically extracted and tagged
- Later query showing the solution being suggested by the router
mix testmix formatBefore committing your changes, run:
mix precommitThis will:
- Compile with warnings as errors
- Remove unused dependencies
- Format code
- Run the test suite
Reset the database:
mix ecto.resetRun migrations:
mix ecto.migrateThe codebase follows Phoenix conventions with domain-driven design:
lib/
βββ elixir_bear/ # π§ Core business logic
β βββ chat/ # π¬ Chat domain
β β βββ conversation.ex # Conversation schema and queries
β β βββ message.ex # Message schema
β β βββ settings.ex # Application settings
β βββ solutions/ # π Solutions domain
β β βββ solution.ex # Solution schema and queries
β β βββ tag.ex # Tag system
β β βββ extractor.ex # AI-powered solution extraction
β β βββ router.ex # Smart solution matching
β βββ ollama.ex # π¦ Ollama API client
β βββ openai.ex # π€ OpenAI API client
β βββ conversation_worker.ex # βοΈ Background processing
β
βββ elixir_bear_web/ # π Web interface
β βββ live/ # β‘ LiveView modules
β β βββ chat_live.ex # Main chat interface
β β βββ solutions_live.ex # Solutions library
β β βββ settings_live.ex # Settings management
β βββ components/ # π§© Reusable UI components
β βββ router.ex # π£οΈ Application routes
β
βββ test/ # π§ͺ Comprehensive test suite
βββ priv/ # π¦ Static assets & migrations
Why Phoenix LiveView?
- Real-time updates without complex JavaScript frameworks
- Server-side rendering with minimal client-side code
- Built-in WebSocket handling and connection management
- Simplified state management
Why SQLite?
- Zero-configuration database setup
- Perfect for single-user or small-team deployments
- Easy backup and portability
- Excellent performance for this use case
Why Background Workers?
- Non-blocking AI API calls
- Smooth user experience during solution extraction
- Scalable processing for multiple concurrent conversations
Key configuration files:
config/config.exs- Application configurationconfig/dev.exs- Development environment settingsconfig/prod.exs- Production environment settingsAGENTS.md- Development guidelines and coding standards
For Developers
- Build a personal library of coding solutions and patterns
- Quickly reference solutions from past AI conversations
- Get context-aware responses with the Prompt Orchestrator
- Learn by reviewing and organizing code snippets
For Teams
- Share and reuse common solutions across projects
- Document tribal knowledge in an accessible format
- Onboard new team members with curated solutions
- Configure team-wide system prompts for consistent AI responses
For Learners
- Study AI-generated solutions with syntax highlighting
- Use Learning Mode (copy blocker) to reinforce learning through manual typing
- Organize learning materials by topic using tags
- Track your coding journey through conversation history
- Benefit from specialized AI tutoring via the Prompt Orchestrator
Contributions are welcome! Please follow the guidelines in AGENTS.md for:
- Phoenix LiveView best practices
- Elixir coding standards
- UI/UX design principles
- Testing strategies
This project is available for personal and educational use.
Built with these amazing technologies:
- Phoenix Framework - The productive web framework
- Phoenix LiveView - Real-time server-rendered HTML
- Elixir - Scalable and maintainable language
- OpenAI - Powerful AI models
- Ollama - Run LLMs locally
Built using Elixir and Phoenix LiveView


