feat(rag): steering notes — tune how Brain answers, stored in Postgres and injected into every system prompt
This commit is contained in:
@@ -85,6 +85,34 @@ uv run uvicorn app.main:app --reload
|
||||
- **Sources** (`/sources.html`) — the indexed document list; the *Path*
|
||||
column links each document to the viewer in a new tab.
|
||||
|
||||
## Tuning your answers
|
||||
|
||||
If an answer isn't quite right — too chatty, wrong assumption, missing
|
||||
context — **tune** Brain right there:
|
||||
|
||||
1. Press **“Tune”** in the meta row under any completed answer (deflected
|
||||
ones included).
|
||||
2. Type a short instruction (1–2000 chars), e.g. *“be more concise”* or
|
||||
*“assume I'm on NixOS”*, and **Save**.
|
||||
|
||||
The note is stored in Postgres (`steering_notes`) and read into the
|
||||
**system prompt of every subsequent chat turn** as a `<tuning>` section
|
||||
(numbered, oldest first, capped at `BOR_STEERING_MAX_CHARS` chars —
|
||||
default 8000, overflow marked `[…truncated…]`). With no stored notes the
|
||||
prompt is byte-identical to the un-tuned one, so tuning is opt-in per
|
||||
note.
|
||||
|
||||
List or remove notes at any time from the **“Tuning”** button in the chat
|
||||
header (count badge, newest-first, per-note delete). The API is stateless
|
||||
JSON if you prefer curl:
|
||||
|
||||
```bash
|
||||
curl -s localhost:8000/api/steering # list (newest first)
|
||||
curl -s -X POST localhost:8000/api/steering \
|
||||
-H 'Content-Type: application/json' -d '{"note": "be more concise"}'
|
||||
curl -s -X DELETE localhost:8000/api/steering/<note-id> # remove
|
||||
```
|
||||
|
||||
## Updating the documents
|
||||
|
||||
**This is the workflow you'll use most.** The knowledge base is refreshed by
|
||||
@@ -270,6 +298,7 @@ served locally (no CDN), `BOR_ENVIRONMENT=production`.
|
||||
| `BOR_RRF_K` | `60` | RRF damping constant (`1/(k + rank)`) |
|
||||
| `BOR_IMPORT_EXTENSIONS` | `md,markdown,txt,yaml,yml,json,py` | csv of importable formats (may only narrow the A9 set) |
|
||||
| `BOR_MAX_CONTEXT_CHARS` | `24000` | cap on total document text sent to the LLM |
|
||||
| `BOR_STEERING_MAX_CHARS` | `8000` | char budget for the `<tuning>` (steering notes) prompt section |
|
||||
| `BOR_SUGGESTIONS` | built-in list | JSON list of onboarding chips |
|
||||
| `DEBUGPY` | `0` | `1` ⇒ attach-on-demand debugpy on `DEBUGPY_PORT` (default 5678) |
|
||||
| `BOR_LOG_LEVEL` | `INFO` | app log level |
|
||||
|
||||
Reference in New Issue
Block a user