feat: behind-the-scenes 👍/👎 rating system (fine-tune data collection)

Brian can rate Lyra's outputs as he uses her; each rating is stored as a
(context, content, rating) triple — the shape a future fine-tune / preference
dataset wants, collected passively during real use.

- memory: ratings table + add_rating (upsert: one row per item, re-rating
  replaces), list_ratings, rating_counts
- server: POST /rate, GET /ratings/counts, GET /ratings/export (JSONL download)
- chat UI: subtle 👍/👎 on each assistant reply, captures the prompting message
  as context
- journal/reflection UI: 👍/👎 on each thought
- tests: counts + upsert-replace behavior

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-18 19:32:27 +00:00
parent 9befe4d403
commit 4f770f2e43
6 changed files with 173 additions and 1 deletions
+11
View File
@@ -994,3 +994,14 @@ select:hover {
border-radius: 6px; padding: 10px 12px; margin: 8px 0; overflow-x: auto;
}
.msg.assistant pre code { background: none; padding: 0; font-size: 0.85em; }
/* Behind-the-scenes 👍/👎 feedback (fine-tune signal) — subtle until hovered. */
.rate-bar { display: flex; gap: 6px; margin-top: 7px; opacity: 0.3; transition: opacity .15s; }
.msg.assistant:hover .rate-bar { opacity: 0.85; }
.rate-btn {
background: none; border: none; cursor: pointer; font-size: 0.85rem;
padding: 2px 5px; border-radius: 5px; line-height: 1; filter: grayscale(0.6);
-webkit-tap-highlight-color: transparent;
}
.rate-btn:hover { filter: none; background: rgba(255,122,0,0.12); }
.rate-btn.rated { filter: none; background: rgba(255,122,0,0.25); opacity: 1; }