Universal terminal chat app for Ollama with local Kiwix content integration. Features Retrieval Augmented Generation (RAG) for enhanced factual responses.
Works with any ZIM file from the Kiwix library:
- Wikipedia (any language)
- Wiktionary (dictionaries)
- Project Gutenberg (books)
- TED Talks
- And 100+ other educational content types
- Terminal chat interface with streaming responses
- Automatic Kiwix content context injection for factual queries
- Works with ANY ZIM file from Kiwix library (Wikipedia, Wiktionary, Project Gutenberg, etc.)
- Clickable hyperlinks that open Kiwix content
- Multi-language support (any language ZIM file)
- Commands:
/help,/exit,/clear,/wiki <query>,/view <query>
Direct Download
# 1. Download and extract the repository
wget https://github.com/imDelivered/OWRs/archive/refs/heads/main.zip
unzip main.zip
cd OWRs-main
# 2. Run the setup script
chmod +x setup.sh && ./setup.sh
# 3. Start the app (it handles everything automatically)
./run_kiwix_chat.shWhat happens automatically:
- Setup script installs Python, Ollama, Kiwix, and RAG dependencies (sentence-transformers, chromadb)
- Embedding models (BGE) are ready - same models used by Perplexica
run_kiwix_chat.shstarts Ollama server automatically- Downloads the AI model if needed (first run only)
- Starts Kiwix server if ZIM file is found https://library.kiwix.org/#lang=eng
- Launches the chat interface
To enable RAG (semantic search):
- Download a ZIM file from https://library.kiwix.org/ and place it in the repo directory
- Build the index:
python3 kiwix_chat.py --build-index - That's it! RAG will work automatically after indexing (one-time setup, may take time)
That's it! No manual steps needed - just run ./run_kiwix_chat.sh after setup.
If you prefer to set up manually, follow these steps:
sudo apt update
sudo apt install -y python3 python3-tk curl wgetVerify Python is installed:
python3 --version
# Should show Python 3.10 or higherOllama is the LLM server that runs the AI models.
# Download and install Ollama
curl -fsSL https://ollama.ai/install.sh | shVerify Ollama is installed:
ollama --versionStart the Ollama server:
ollama serveLeave this terminal open. Open a new terminal for the next steps.
In the new terminal, download a small model (llama3.2:1b is ~1.3GB, perfect for testing):
ollama pull llama3.2:1bThis will take a few minutes depending on your internet speed. You'll see download progress.
Verify the model downloaded:
ollama list
# Should show llama3.2:1bKiwix serves ZIM files locally (Wikipedia, Wiktionary, Project Gutenberg, etc.).
sudo apt install -y kiwix-toolsVerify installation:
kiwix-serve --versionThe ZIM file contains educational content offline. This is optional but recommended. The app works with ANY ZIM file from the Kiwix library - not just Wikipedia!
Browse and download from the official Kiwix Library: 👉 https://library.kiwix.org/
Universal Kiwix support: The app works with any ZIM file from the Kiwix library:
Wikipedia (any language):
- English:
wikipedia_en_all_nopic_2025-07.zim(~20GB) - Spanish:
wikipedia_es_all_nopic_2025-07.zim(~15GB) - French:
wikipedia_fr_all_nopic_2025-07.zim(~18GB) - German:
wikipedia_de_all_nopic_2025-07.zim(~20GB) - Simple English:
wikipedia_en_simple_all_nopic_2025-07.zim(~1.5GB, easier language) - Any other language available in the Kiwix library
Other content types: The app works with ALL Kiwix ZIM files:
- Wiktionary - Dictionaries in multiple languages
- Project Gutenberg - Free ebooks
- TED Talks - Educational videos
- Stack Overflow - Programming Q&A
- And 100+ other content types available at library.kiwix.org
Once downloaded, place the .zim file in your repo directory, ~, or /usr/share/kiwix/. The app will auto-detect it.
After downloading a ZIM file, build the RAG index:
# Build the vector index (one-time setup, may take time)
python3 kiwix_chat.py --build-index
# This creates embeddings for semantic search using BGE models (same as Perplexica)
# The index will be used automatically for all future queriesNote: The index build is a one-time process. It processes articles and creates embeddings for semantic search. This may take 30 minutes to several hours depending on the ZIM file size. You can interrupt and resume later - progress is saved.
Or download directly via command line:
# Navigate to your repo directory
cd /path/to/wiki-chat
# Download Wikipedia ZIM file (any language, no images)
# Example: English Wikipedia (~20GB)
wget -c https://download.kiwix.org/zim/wikipedia/wikipedia_en_all_nopic_2025-07.zim
# Example: Spanish Wikipedia (~15GB)
wget -c https://download.kiwix.org/zim/wikipedia/wikipedia_es_all_nopic_2025-07.zimNote: ZIM files can be large! You can skip this step if you just want to test the chat without Kiwix content features. The app will work, but /wiki commands won't function.
# Clone or download this repository
git clone <your-repo-url>
cd wiki-chat
# Or if you already have the files, just navigate to the directory
cd /path/to/wiki-chatMake the launcher executable:
chmod +x run_kiwix_chat.shRun it:
./run_kiwix_chat.shThe launcher will:
- Check if Ollama is running (starts it if not)
- Check if your model is available (pulls it if missing)
- Start Kiwix server if ZIM file exists
- Launch the chat interface
First time setup: The launcher may take a minute to start everything.
Once the app launches, you'll see a chat interface. Just type your questions!
Example:
You: What is quantum computing?
AI: [Provides detailed answer with Wikipedia context if available]
/help- Show all available commands/exit- Quit the application/clear- Clear chat history/wiki <query>- Manually fetch Wikipedia articles (e.g.,/wiki Python programming)/view <query>- Open Wikipedia article in popup window/detailed on|off- Toggle detailed response style/links on|off- Toggle hyperlink summary display
Run with custom settings:
python3 kiwix_chat.py --model llama3.2:1b --detailed --wiki-max-chars 6000Available options:
--model NAME- Use different Ollama model (default: dolphin-llama3)--detailed- Start in detailed response mode--wiki-max-chars N- Max characters per Kiwix content item (default: 4000)--zim-file PATH- Specify path to ZIM file (any language/content type). If not specified, auto-detects first .zim file found.--no-stream- Disable streaming output--no-links- Disable hyperlink summary--build-index- Build RAG vector index from ZIM file (one-time setup)--rebuild-index- Rebuild RAG index (if ZIM file changed)--index-status- Check RAG index status--rag-status- Show full RAG system status (models, index, etc.)--use-rag/--no-rag- Enable/disable RAG (default: enabled if index exists)
If you see "Ollama not accessible":
# Check if Ollama is running
ps aux | grep ollama
# Start it manually
ollama serveIf you see "model not found":
# List available models
ollama list
# Pull the model if missing
ollama pull llama3.2:1bIf /wiki commands fail:
# Check if Kiwix is running
curl http://localhost:8081
# Check if ZIM file exists (any language)
ls -lh *.zim
# Start Kiwix manually (replace with your ZIM file path)
kiwix-serve --port=8081 /path/to/your/wikipedia_XX_all_nopic_2025-07.zim
# Or specify ZIM file when running the app
python3 kiwix_chat.py --zim-file /path/to/your/wikipedia_es_all_nopic_2025-07.zimIf GUI doesn't open:
# Install tkinter
sudo apt install -y python3-tk
# Test tkinter
python3 -c "import tkinter; print('OK')"Platform: Linux only (Windows and macOS support coming in the future)
Minimum:
- 4GB RAM (8GB recommended)
- 20GB free disk space (for model + ZIM file)
- Python 3.10+
- Internet connection (for initial setup)
Recommended:
- 16GB RAM
- 50GB free disk space
- 4+ CPU cores
- GPU (optional, for faster inference)
- Ollama: Runs the AI language model (llama3, etc.)
- Kiwix: Serves Wikipedia articles from the ZIM file
- ZIM File: Contains all Wikipedia articles offline
- kiwix_chat.py: The main chat application (Kiwix RAG)
- The ZIM file is large (~20GB) and excluded from git
- Models are downloaded to
~/.ollama/models/(several GB each) - Works without ZIM file, but
/wikicommands won't work - Works with any Ollama model - change with
--modelflag - First run may be slow as models load into memory
Start everything:
./run_kiwix_chat.shManual start (if launcher has issues):
# Terminal 1: Start Ollama
ollama serve
# Terminal 2: Start Kiwix (if you have ZIM file, any language)
kiwix-serve --port=8081 /path/to/your/wikipedia_XX_all_nopic_2025-07.zim
# Terminal 3: Run the app
python3 kiwix_chat.py --model llama3.2:1bThat's it! You're ready to chat with AI + Wikipedia.