forked from kent/consciousness
config: move user_name/assistant_name to AppConfig (top level)
These are identity settings, not memory-graph settings. Sat inside the \`memory\` section only because that's where Config started life. Move to AppConfig alongside the other top-level stuff. Readers now pull from \`config::app()\` instead of \`config::get()\`. subconscious/defs.rs's conversation-building pass still needs Config for surface_conversation_bytes, so both guards coexist there — AppConfig's guard is dropped before the per-step await loop so we don't stall the config-watcher's writer. show_config picks up the two new fields at the top of its output. Kent's config already has them hoisted to the top level. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
dd551fe551
commit
592a3e2e52
6 changed files with 29 additions and 18 deletions
|
|
@ -40,8 +40,6 @@ fn default_identity_dir() -> PathBuf {
|
|||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Config {
|
||||
pub user_name: String,
|
||||
pub assistant_name: String,
|
||||
#[serde(deserialize_with = "deserialize_path")]
|
||||
pub data_dir: PathBuf,
|
||||
#[serde(default = "default_identity_dir", deserialize_with = "deserialize_path")]
|
||||
|
|
@ -91,8 +89,6 @@ impl Default for Config {
|
|||
fn default() -> Self {
|
||||
let home = dirs::home_dir().unwrap_or_default();
|
||||
Self {
|
||||
user_name: "User".to_string(),
|
||||
assistant_name: "Assistant".to_string(),
|
||||
data_dir: home.join(".consciousness/memory"),
|
||||
identity_dir: home.join(".consciousness/identity"),
|
||||
projects_dir: home.join(".claude/projects"),
|
||||
|
|
@ -229,6 +225,10 @@ pub fn watch_config(cli: crate::user::CliArgs) {
|
|||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AppConfig {
|
||||
#[serde(default = "default_user_name")]
|
||||
pub user_name: String,
|
||||
#[serde(default = "default_assistant_name")]
|
||||
pub assistant_name: String,
|
||||
/// Named model endpoints — credentials, base URL, and model id bundled
|
||||
/// into one entry per backend. Keyed by name, selected by
|
||||
/// `default_backend` or by `--model <name>` on the CLI.
|
||||
|
|
@ -315,9 +315,14 @@ impl Default for LearnConfig {
|
|||
}
|
||||
}
|
||||
|
||||
fn default_user_name() -> String { "User".into() }
|
||||
fn default_assistant_name() -> String { "Assistant".into() }
|
||||
|
||||
impl Default for AppConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
user_name: default_user_name(),
|
||||
assistant_name: default_assistant_name(),
|
||||
backends: HashMap::new(),
|
||||
default_backend: String::new(),
|
||||
debug: false,
|
||||
|
|
@ -534,7 +539,9 @@ pub fn show_config(app: &AppConfig, figment: &Figment) {
|
|||
}
|
||||
|
||||
println!("# Effective configuration\n");
|
||||
println!("debug: {} ({})", app.debug, src(figment, "debug"));
|
||||
println!("user_name: {:?} ({})", app.user_name, src(figment, "user_name"));
|
||||
println!("assistant_name: {:?} ({})", app.assistant_name, src(figment, "assistant_name"));
|
||||
println!("\ndebug: {} ({})", app.debug, src(figment, "debug"));
|
||||
println!("\ncompaction:");
|
||||
println!(" hard_threshold_pct: {} ({})", app.compaction.hard_threshold_pct, src(figment, "compaction.hard_threshold_pct"));
|
||||
println!(" soft_threshold_pct: {} ({})", app.compaction.soft_threshold_pct, src(figment, "compaction.soft_threshold_pct"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue