Real-time AI chat interface with persistent conversation history and embeddings
[π¬ Screenshot Coming Soon]
- π¬ Real-time AI Chat - Interactive conversational AI interface
- ποΈ Persistent Conversations - SQLite-based conversation storage
- π Semantic Search - Text embeddings for intelligent conversation retrieval
- π FastAPI Backend - High-performance async API
- π¨ Modern Web UI - Clean, responsive chat interface
- π RESTful API - Full API access for custom integrations
- π Session Management - Multi-conversation support
- Python 3.8 or higher
- pip package manager
-
Clone the repository:
cd /path/to/alter-lab -
Install dependencies:
pip install -r requirements.txt
-
Ensure Ollama is running:
# Start Ollama service brew services start ollama # Verify it's running curl http://localhost:11434/api/tags
-
Start the server:
Option A: Using the startup script (recommended)
./start.sh
Option B: Manual start
python3 -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Open in browser:
http://localhost:8000
That's it! The interface will load with:
- Conversation history sidebar on the left
- Chat interface in the center
- Real AI responses using Ollama (llama3.2:1b model)
- Navigate to
http://localhost:8000 - Type your message in the chat box
- Press Enter or click Send
- View conversation history in the sidebar
curl -X POST "http://localhost:8000/chat" \
-H "Content-Type: application/json" \
-d '{"message": "Hello, how are you?"}'Response:
{
"response": "I'm doing well, thank you!",
"conversation_id": "abc123"
}curl "http://localhost:8000/conversations"curl "http://localhost:8000/conversations/abc123"curl -X DELETE "http://localhost:8000/conversations/abc123"http://localhost:8000/docs
alter-lab/
βββ app/
β βββ main.py # FastAPI application & web UI
β βββ chat.py # Chat logic & AI integration
β βββ db.py # Database operations
β βββ embeddings.py # Text embeddings & semantic search
βββ memory.db # SQLite database
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Backend: FastAPI (Python)
- Database: SQLite
- AI Integration: Configurable (Ollama/OpenAI/HuggingFace)
- Embeddings: Sentence Transformers
- Frontend: Vanilla JavaScript + HTML/CSS
Edit app/chat.py to configure your AI model:
# Option 1: Use Ollama (local, free)
# Requires: brew install ollama && ollama pull llama2
# Option 2: Use OpenAI (API key required)
# Set environment variable: export OPENAI_API_KEY=your_key
# Option 3: Use HuggingFace Transformers (local)
# Automatically downloads models on first runThe application uses SQLite by default. The database file memory.db is created automatically on first run.
To reset the database:
rm memory.db
# Restart the serveruvicorn app.main:app --reload --host 0.0.0.0 --port 8000pytest tests/tail -f server.logdocker build -t alter-lab .
docker run -p 8000:8000 alter-labDeploy to Railway, Render, or Fly.io:
- Push code to GitHub
- Connect repository to platform
- Set environment variables (if using OpenAI)
- Deploy
Live Demo: Coming Soon
- Basic chat functionality
- Conversation persistence
- RESTful API
- Real AI model integration (Ollama + OpenAI fallback)
- Conversation history UI with sidebar
- Multi-conversation support
- Conversation management (create, delete, switch)
- Real-time chat interface
- Semantic search with embeddings
- User authentication
- Multi-user support
- Export conversations
- Markdown rendering for AI responses
[Coming Soon]
[Coming Soon]
Server won't start:
# Check if port 8000 is already in use
lsof -i :8000
# Kill the process if needed
kill -9 <PID>Database errors:
# Reset database
rm memory.db
# Restart serverImport errors:
# Reinstall dependencies
pip install -r requirements.txt --force-reinstallContributions welcome! Areas needing work:
- AI model integration improvements
- UI/UX enhancements
- Additional API endpoints
- Documentation improvements
MIT License - Feel free to use and modify!
Built with:
- FastAPI - Modern web framework
- SQLite - Lightweight database
- Sentence Transformers - Text embeddings