hive-agent: no hard-coded context window sizes, the window is what the API reports
This commit is contained in:
parent
4a109fa038
commit
1bfee54414
1 changed files with 47 additions and 124 deletions
|
|
@ -444,13 +444,12 @@ fn compact(bus: &Bus, wake_prompt: Option<String>) -> Response {
|
|||
message: "compact refused: no completed turn yet — nothing to compact".to_owned(),
|
||||
};
|
||||
};
|
||||
let model = bus.model();
|
||||
let window = bus.effective_context_window(&model);
|
||||
if window == 0 {
|
||||
let Some(window) = bus.api_context_window() else {
|
||||
return Response::Err {
|
||||
message: "compact refused: effective context window is unknown (0)".to_owned(),
|
||||
message: "compact refused: the context window is unknown until a turn reports it"
|
||||
.to_owned(),
|
||||
};
|
||||
}
|
||||
};
|
||||
// Token counts stay well under 2^53 in practice, so the f64 conversion is exact.
|
||||
// The ratio is only compared against a fixed threshold, so a last-place rounding error cannot change the outcome.
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue