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
View File
@@ -189,6 +189,11 @@ async fn serve(cfg: &Config, cli_host: Option<&str>, cli_port: Option<u16>) -> E
return ExitCode::FAILURE;
}
};
// Seed the global default settings template from the config (once). Each
// new session snapshots these defaults at creation (copy-on-create).
if matches!(store.get_defaults(), Ok(None)) {
let _ = store.set_defaults(&cfg.default_settings());
}
let app = router_with_store(svc, store, auth);
let host = cfg.bind_host(cli_host);
let port = cfg.bind_port(cli_port);