ocean-chat-simple
A FastAPI web app with several Claude-powered chat personas (default Claude friend, MKM, Wuthering Vampires) plus a beach poems page. Conversations are persisted as JSON under chat_logs/.
Requirements
- Python 3.11.9 (see
runtime.txt) - An Anthropic API key
Setup
# 1. Create and activate a virtualenv
python3 -m venv venv
source venv/bin/activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Create a .env file in the project root
.env should contain:
ANTHROPIC_API_KEY=your-key-here
NODE_ENV=dev
Run locally
source venv/bin/activate
uvicorn main:app --reload
The app will be available at http://127.0.0.1:8000.
Routes
| Path | Description | |||
|---|---|---|---|---|
/ | Claude chat (loads last 3 conversation pairs from chat_logs/claude.json) | |||
/claude | Same as / | |||
/mkm | MKM chat persona | |||
/vampire-heights | Wuthering Vampires chat persona | |||
/beach-poems | List of beach poems | |||
POST /api/chat | JSON chat endpoint — body: `{"message": "...", "type": "ocean\ | mkm\ | vampire\ | claude"}` |
GET /download/{filename} | Download a chat log JSON file (e.g. claude, data, mkm-data, vampire-heights) |
Run in production (gunicorn)
gunicorn_start is a sample script for an Ubuntu deployment binding to a Unix socket. Adjust DIR, USER, and GROUP for your environment, then:
chmod +x gunicorn_start
./gunicorn_start
Or run gunicorn directly with uvicorn workers:
gunicorn main:app -c gunicorn_conf.py -k uvicorn.workers.UvicornWorker
Project layout
main.py— FastAPI app and routesclaude_chat.py,mkm_chat.py,wuthering_vampires_chat.py,ocean_chat.py— per-persona chat handlersconversation_memory.py— conversation memory helperstemplates/— Jinja2 templatesstatic/— static assetschat_logs/— persisted conversation JSON (gitignored)