Restore env and CLI model configuration
This commit is contained in:
1 parent
7c80500280
commit
fd8e0ddea5
5 files changed
+77
-384
No files matched your search
@@ -24,33 +24,12 @@ python run_example.py --help
|
||||
|
||||
`.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. When any connection option is supplied, 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.
|
||||
|
||||
Press **Ctrl+M** to add, edit, delete, and select saved connections. Use **Back** to leave the picker without saving; if you leave it at launch, press **Ctrl+M** to reopen it. Connections are stored in `sloppy.json` in the current working directory:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": {
|
||||
"local": {
|
||||
"name": "Local Llama",
|
||||
"base_url": "http://localhost:11434/v1",
|
||||
"api_key": "env:LOCAL_API_KEY",
|
||||
"model": "llama3",
|
||||
"system_prompt": "You are a helpful assistant."
|
||||
}
|
||||
},
|
||||
"selected": {"ai1": "local", "ai2": "local"}
|
||||
}
|
||||
```
|
||||
|
||||
Set `LOCAL_API_KEY` in the process environment when using `env:LOCAL_API_KEY`. The app resolves it when selecting the connection. You can select the current `.env` connection for either speaker. `.env` values are reread on launch and are never copied into `sloppy.json`. With complete `.env` connections and no `sloppy.json`, the conversation starts directly; otherwise a picker opens. Changes to speaker selection during a conversation apply on the next run.
|
||||
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 |
|
||||
| --- | --- |
|
||||
| Ctrl+M | Connections and speaker selection |
|
||||
| Ctrl+P | Command palette |
|
||||
| F1 | Reading controls |
|
||||
| S or F2 | Sharing menu |
|
||||
| Mouse wheel, Up / Down, Page Up / Page Down | Scroll |
|
||||
@@ -63,9 +42,7 @@ The sharing menu saves the full conversation or visible screen as SVG in `screen
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **No connection in the picker:** Complete the base URL and key in `.env`, or add a saved connection with **Ctrl+M**.
|
||||
- **Missing API key:** Set the environment variable named by a saved `env:NAME` reference before launch.
|
||||
- **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.
|
||||
- **Invalid settings:** Fix malformed `sloppy.json` in the current working directory. `models` and `selected` must be objects; connection fields and selections must be strings. The error identifies the invalid field.
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for code structure and tests.
|
||||
Reference in new issue
Block a user