Session ops and ContextPolicy in hx-core
This commit is contained in:
1 parent
69d5ae4581
commit
be74dd9fec
7 files changed
+205
-105
No files matched your search
+10
-18
@@ -685,10 +685,12 @@ async fn main() -> Result<()> {
|
||||
if let Some(n) = cfg.max_tokens {
|
||||
agent.set_max_tokens(n);
|
||||
}
|
||||
match cfg.compact_at {
|
||||
Some(n) => agent.set_compact_at(n),
|
||||
None => agent.fit_window(hx_ai::models::window(&models, agent.model())),
|
||||
}
|
||||
agent.set_context_policy(match cfg.compact_at {
|
||||
Some(n) => hx_core::window::ContextPolicy::Fixed(n),
|
||||
None => hx_core::window::ContextPolicy::FromModel {
|
||||
window: hx_ai::models::window(&models, agent.model()),
|
||||
},
|
||||
});
|
||||
let exts = futures::future::join_all(cfg.extensions.iter().map(|e| async {
|
||||
hx_core::ext::Extension::start(e, &cwd)
|
||||
.await
|
||||
@@ -802,13 +804,8 @@ async fn main() -> Result<()> {
|
||||
specs,
|
||||
files: hx_tui::project_files(&cwd),
|
||||
session_dir: dir,
|
||||
switcher: Switcher::new(
|
||||
kind,
|
||||
models.clone(),
|
||||
Box::new(provider),
|
||||
cfg.compact_at.is_none(),
|
||||
)
|
||||
.remember_in(last_path.clone(), start.clone()),
|
||||
switcher: Switcher::new(kind, models.clone(), Box::new(provider))
|
||||
.remember_in(last_path.clone(), start.clone()),
|
||||
},
|
||||
)
|
||||
.await;
|
||||
@@ -822,13 +819,8 @@ async fn main() -> Result<()> {
|
||||
let Some(prompt) = cli.print else {
|
||||
hx_tui::run(hx_tui::Setup {
|
||||
agent,
|
||||
switcher: Switcher::new(
|
||||
kind,
|
||||
models.clone(),
|
||||
Box::new(provider),
|
||||
cfg.compact_at.is_none(),
|
||||
)
|
||||
.remember_in(last_path, start),
|
||||
switcher: Switcher::new(kind, models.clone(), Box::new(provider))
|
||||
.remember_in(last_path, start),
|
||||
pricing,
|
||||
specs,
|
||||
open_sessions,
|
||||
|
||||
Reference in new issue
Block a user