138 lines
4.0 KiB
Markdown
138 lines
4.0 KiB
Markdown
# DreamWiki
|
||
|
||
A single-file, AI-generated Wikipedia clone that creates fictional encyclopedia articles on-demand using Large Language Models via the OpenRouter API.
|
||
|
||
## Overview
|
||
|
||
DreamWiki is a creative web application that generates Wikipedia-style articles about anything you can imagine. When you visit a non-existent page, the application queries an LLM to generate a complete, interconnected article with links to other fictional pages, creating an ever-expanding universe of AI-generated lore.
|
||
|
||
**Note:** This is a creative experiment. All content is fictional and generated by AI.
|
||
|
||
## Features
|
||
|
||
- <¯ Single-file Python application for easy deployment
|
||
- > AI-generated articles via OpenRouter API
|
||
- =Ý Wikipedia-style formatting with Markdown
|
||
- = Automatic internal linking between articles
|
||
- <¨ Clean, Wikipedia-inspired interface
|
||
- =¾ Persistent article storage as Markdown files
|
||
- =
|
||
Search functionality to explore any topic
|
||
|
||
## Prerequisites
|
||
|
||
- Python 3.13+
|
||
- UV package manager
|
||
- OpenRouter API account and key
|
||
|
||
## Quick Start
|
||
|
||
1. **Clone and enter the project directory:**
|
||
```bash
|
||
cd /path/to/aignorance
|
||
```
|
||
|
||
2. **Install dependencies using UV:**
|
||
```bash
|
||
uv add fastapi uvicorn python-dotenv requests markdown2 jinja2
|
||
```
|
||
|
||
3. **Set up your environment:**
|
||
```bash
|
||
cp .env.example .env
|
||
```
|
||
|
||
Edit `.env` and add your OpenRouter credentials:
|
||
```
|
||
OPENROUTER_API_KEY=your_actual_api_key_here
|
||
OPENROUTER_MODEL=mistralai/mistral-7b-instruct
|
||
```
|
||
|
||
4. **Run the application:**
|
||
```bash
|
||
uv run uvicorn app:app --reload
|
||
```
|
||
|
||
5. **Open your browser:**
|
||
Visit `http://localhost:8000` and start exploring!
|
||
|
||
## Configuration
|
||
|
||
### Environment Variables
|
||
|
||
- `OPENROUTER_API_KEY`: Your OpenRouter API key (get one at https://openrouter.ai/)
|
||
- `OPENROUTER_MODEL`: The model to use for generation
|
||
|
||
### Supported Models
|
||
|
||
Any OpenRouter-compatible model works. Popular choices:
|
||
- `mistralai/mistral-7b-instruct` (fast, creative)
|
||
- `anthropic/claude-3-haiku` (high quality, more expensive)
|
||
- `openai/gpt-3.5-turbo` (balanced performance)
|
||
|
||
## How It Works
|
||
|
||
1. User visits `/wiki/Some_Topic`
|
||
2. If the article doesn't exist, DreamWiki calls the OpenRouter API
|
||
3. The LLM generates a complete Markdown article with:
|
||
- Multiple sections (History, Characteristics, etc.)
|
||
- Internal links to other fictional articles
|
||
- At least one table
|
||
- A placeholder image
|
||
4. The article is saved locally and rendered as HTML
|
||
5. Future visits to the same topic load the cached version
|
||
|
||
## File Structure
|
||
|
||
```
|
||
aignorance/
|
||
|