forked from kent/consciousness
config: unify subconscious API resolution with the main chat path
Two parallel backend-resolution paths had drifted apart:
- Main chat: AppConfig::resolve_model() → a named BackendConfig in
AppConfig.backends
- Subconscious / oneshot / context_window(): four skip-serde
"cache" fields on Config (memory section) — api_base_url, api_key,
api_model, api_context_window — that used to be populated at
Config::try_load_shared time by walking memory.agent_model →
root.models[name] → root[backend_name]
When we renamed `models` to `backends` and collapsed ModelConfig into
BackendConfig, the latter chain started silently dereferencing
`root.get("models")` → None → no population. Subconscious agents fell
through the "API not configured" guard; context_window() started
returning 0 (since api_context_window default is u64's 0 now that we
don't populate it). It was only visibly working for the main chat.
Collapse to one path:
- Drop Config.agent_model (duplicate of AppConfig.default_backend)
- Drop Config.{api_base_url, api_key, api_model, api_context_window}
— no longer populated, no longer needed
- Drop default_context_window() — nobody reads the field anymore
- Drop the memory-side resolution block in try_load_shared()
- Subconscious (mind/unconscious.rs) and oneshot (agent/oneshot.rs)
now call load_app() + resolve_model(&app.default_backend) just like
the main chat does
- context_window() reads from config::app().backends[default_backend]
.context_window, defaulting to 128k only if the backend doesn't
specify one
Side effect: Kent's config file drops agent_model, api_reasoning,
journal_days, journal_max — all fields whose Rust counterparts are
now gone. (Figment tolerates unknown fields, so leaving them wouldn't
have broken anything, but they were lying about what's configurable.)
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
28484a385b
commit
60de579305
4 changed files with 21 additions and 60 deletions
|
|
@ -992,7 +992,10 @@ impl ContextState {
|
|||
}
|
||||
|
||||
pub fn context_window() -> usize {
|
||||
crate::config::get().api_context_window
|
||||
let app = crate::config::app();
|
||||
app.backends.get(&app.default_backend)
|
||||
.and_then(|b| b.context_window)
|
||||
.unwrap_or(128_000)
|
||||
}
|
||||
|
||||
pub fn context_budget_tokens() -> usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue