mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-29 04:10:00 +08:00
fix(hermes-model-switch): clear stale 'context_length' when switching model in config.yaml
When the user switches model via the model picker, hermes_update_model rewrites model.default and model.provider in config.yaml but historically left model.context_length untouched. The Hermes kernel (8ac351407, May 2026) now actively clears that field on model switch because the previous model's context window almost never matches the new model — leaving the stale value caused 'context too large' errors and silently truncated output. Mirror the upstream behavior by dropping the context_length line as we walk the model: block, so Hermes falls back to the new model's default window.
This commit is contained in:
@@ -2278,6 +2278,12 @@ pub async fn hermes_update_model(
|
||||
provider_written = true;
|
||||
continue;
|
||||
}
|
||||
// 与 Hermes 内核 8ac351407 保持一致:切模型时清掉旧 context_length,
|
||||
// 否则新模型会沿用上一个模型的 context window(典型表现:context 报错
|
||||
// / 输出被截断)。删除该行即可,Hermes 会按新模型默认窗口生效。
|
||||
if trimmed.starts_with("context_length:") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
out.push(line.to_string());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user