Files

49 lines
2.6 KiB
Markdown

# Sloppy
Sloppy is a terminal app where two AI models discuss an initial prompt. AI 1 replies first, then AI 2, alternating for a chosen number of replies. It supports OpenAI-compatible chat-completions APIs, including local servers.
## Setup
Use Python 3.10 or newer and configure two reachable models. The same endpoint can serve both.
```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
Copy-Item .env.example .env
```
Edit `.env` for your endpoints, keys, model IDs, and topic, then run `python run_example.py`. On macOS or Linux, activate with `source .venv/bin/activate` and copy the example with `cp .env.example .env`. `python ai_chat.py` is an equivalent entry point.
```powershell
python run_example.py --prompt "Can AI be creative?" --turns 6
python run_example.py --help
```
## Configuration
`.env` accepts `AI1_NAME`, `AI1_BASE_URL`, `AI1_API_KEY`, `AI1_MODEL`, and `AI1_SYSTEM_PROMPT`, plus matching `AI2_*` variables. `INITIAL_PROMPT` is required. `MAX_TURNS` defaults to 20 and must be positive. Set each base URL to an API root such as `http://localhost:11434/v1`; Sloppy appends `/chat/completions`.
Command-line options `--ai1-name`, `--ai1-url`, `--ai1-key`, `--ai1-model`, `--ai1-prompt` and matching `--ai2-*` options override `.env` values for a run. Both connections need a base URL and API key after applying defaults. Prefer environment variables over command-line arguments for hosted-provider secrets, since command-line values can enter shell history.
## Controls and exports
| Key | Action |
| --- | --- |
| F1 | Reading controls |
| S or F2 | Sharing menu |
| Mouse wheel, Up / Down, Page Up / Page Down | Scroll |
| Home / End | Oldest / latest message |
| Ctrl+C | Quit |
Scrolling up pauses automatic following; **End** resumes it. The UI shows elapsed time, reply count, word counts, and token usage when the provider reports it. Token and speed figures may be estimates when usage is unavailable.
The sharing menu saves the full conversation or visible screen as SVG in `screenshots/`, or a Markdown transcript in `transcripts/`. The transcript includes the initial prompt and replies in order. Both directories are created in the current working directory and ignored by Git.
## Troubleshooting
- **Missing connection:** Complete the base URL and key in `.env` or supply them with CLI arguments.
- **API error:** Check the API root, model ID, server availability, and credentials. A failed or incomplete stream falls back to a non-streaming request; transport and empty-response failures receive up to two retries.
See [CONTRIBUTING.md](CONTRIBUTING.md) for code structure and tests.