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:
1 parent
0123f41d99
commit
0568b92e06
9 files changed
+556
-100
No files matched your search
@@ -80,6 +80,10 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub sampling: SamplingDefaults,
|
||||
|
||||
/// General default System Prompt, snapshotted into each new GUI session.
|
||||
#[serde(default)]
|
||||
pub system_prompt: Option<String>,
|
||||
|
||||
/// Startup (wait for `READY`) and silence-watchdog timeouts, in seconds.
|
||||
/// Optional: both default to 600s when absent.
|
||||
#[serde(default)]
|
||||
@@ -206,6 +210,20 @@ impl Config {
|
||||
PathBuf::from(home).join(".config/strata-ctl/sessions.db")
|
||||
}
|
||||
|
||||
/// The global default settings template for new GUI sessions, seeded from
|
||||
/// the config's general system prompt and sampling defaults. Each session
|
||||
/// snapshots this at creation (copy-on-create) and then owns its instance.
|
||||
pub fn default_settings(&self) -> crate::store::SessionSettings {
|
||||
crate::store::SessionSettings {
|
||||
system_prompt: self.system_prompt.clone(),
|
||||
temperature: self.sampling.temperature,
|
||||
top_p: self.sampling.top_p,
|
||||
min_p: self.sampling.min_p,
|
||||
repetition_penalty: self.sampling.repetition_penalty,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// The top-level keys present in the file that we are not acting on —
|
||||
/// reported by `--check` so the shared-file contract stays visible.
|
||||
pub fn ignored_keys(&self) -> Vec<&str> {
|
||||
|
||||
Reference in new issue
Block a user