Session settings copy-on-create + immutable friendly names

- SessionSettings instance per session (system_prompt, notes, sampling), snapshotted from global defaults at creation (copy-on-create); editing a session affects only it, editing globals affects only future sessions. Global defaults template stored in DB, seeded from config; GET/PUT /api/settings/defaults.

- Framework-assigned evocative names (word list, src/name.rs) replace the auto-title (removed). Name editable only before the first interaction, then locked (name_locked); PATCH rejects post-lock rename. Session notes carry the user-defined purpose.

- Idempotent migration adds settings_json/name_locked and backfills old sessions; build_request uses the session's own settings snapshot. 112 tests green, clippy/fmt clean; verified live (migration, name lock, settings isolation).
This commit is contained in:
adm committed 2026-11-25 15:44:52 +01:00
1 parent 0123f41d99
commit 0568b92e06
9 files changed
+556 -100

No files matched your search

+5 -1
View File
@@ -62,10 +62,14 @@ fn build_router(state: AppState, auth: AuthConfig) -> Router {
"/api/sessions/{id}",
get(sessions::get_session)
.delete(sessions::delete_session)
.patch(sessions::rename_session),
.patch(sessions::patch_session),
)
.route("/api/sessions/{id}/messages", get(sessions::get_messages))
.route("/api/sessions/{id}/chat", post(sessions::session_chat))
.route(
"/api/settings/defaults",
get(sessions::get_defaults).put(sessions::put_defaults),
)
.route("/api/stats", get(sessions::stats))
.route("/", get(web::index))
.route("/assets/{*path}", get(web::asset));