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
|
|
@ -396,13 +396,14 @@ fn resolve_conversation(budget: Option<usize>) -> String {
|
|||
|
||||
let cfg = crate::config::get();
|
||||
let max_bytes = budget.unwrap_or_else(|| cfg.surface_conversation_bytes.unwrap_or(100_000));
|
||||
let app = crate::config::app();
|
||||
let mut fragments: Vec<String> = Vec::new();
|
||||
let mut total_bytes = 0;
|
||||
let mut oldest_ts = String::new();
|
||||
|
||||
for (role, content, ts) in iter {
|
||||
if total_bytes >= max_bytes { break; }
|
||||
let name = if role == "user" { &cfg.user_name } else { &cfg.assistant_name };
|
||||
let name = if role == "user" { &app.user_name } else { &app.assistant_name };
|
||||
let formatted = if !ts.is_empty() {
|
||||
oldest_ts = ts[..ts.floor_char_boundary(ts.len().min(19))].to_string();
|
||||
format!("**{}** {}: {}", name, &oldest_ts, content)
|
||||
|
|
@ -623,11 +624,13 @@ pub async fn run_agent(
|
|||
let mut all_keys = keys;
|
||||
let mut resolved_steps = Vec::new();
|
||||
for step in &def.steps {
|
||||
let cfg = crate::config::get();
|
||||
let template = step.prompt
|
||||
.replace("{agent_name}", &def.agent)
|
||||
.replace("{user_name}", &cfg.user_name)
|
||||
.replace("{assistant_name}", &cfg.assistant_name);
|
||||
let template = {
|
||||
let app = crate::config::app();
|
||||
step.prompt
|
||||
.replace("{agent_name}", &def.agent)
|
||||
.replace("{user_name}", &app.user_name)
|
||||
.replace("{assistant_name}", &app.assistant_name)
|
||||
};
|
||||
let (prompt, extra_keys) = resolve_placeholders(&template, &all_keys, count).await;
|
||||
all_keys.extend(extra_keys);
|
||||
resolved_steps.push(super::prompts::ResolvedStep {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue