WIP v0.2.0: pannello /endpoint e nomi abbreviati dei modelli (in pausa, non compilato)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,17 @@ impl Session {
|
||||
{
|
||||
warn!("failed to refresh critical path timing config: {err}");
|
||||
}
|
||||
// Per-model settings of the active provider apply to new turns without a restart.
|
||||
let refresh_model_settings = !matches!(scope, RuntimeConfigRefresh::Mcp);
|
||||
if refresh_model_settings
|
||||
&& let Some(next) = next_config.model_providers.get(&config.model_provider_id)
|
||||
{
|
||||
let models = next.models.clone();
|
||||
if let Some(provider) = config.model_providers.get_mut(&config.model_provider_id) {
|
||||
provider.models = models.clone();
|
||||
}
|
||||
config.model_provider.models = models;
|
||||
}
|
||||
let config = Arc::new(config);
|
||||
let notify_contributors = !matches!(scope, RuntimeConfigRefresh::Mcp)
|
||||
&& !self.services.extensions.config_contributors().is_empty();
|
||||
@@ -108,6 +119,13 @@ impl Session {
|
||||
let previous_config = notify_contributors
|
||||
.then(|| self.build_effective_session_config(&state.session_configuration));
|
||||
state.session_configuration.original_config_do_not_use = Arc::clone(&config);
|
||||
if refresh_model_settings {
|
||||
state.session_configuration.model_info_overrides.context_windows =
|
||||
config.model_context_windows();
|
||||
self.services
|
||||
.model_client
|
||||
.set_model_settings(config.model_provider.models.clone());
|
||||
}
|
||||
if matches!(scope, RuntimeConfigRefresh::Mcp) {
|
||||
self.services.mcp_runtime.invalidate_resource_caches();
|
||||
}
|
||||
|
||||
@@ -176,6 +176,8 @@ impl ResolvedStepSettings {
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub(crate) struct ModelInfoOverrides {
|
||||
pub(crate) context_window: Option<i64>,
|
||||
/// Per-model context windows of the active provider; refreshed with the user config.
|
||||
pub(crate) context_windows: std::collections::HashMap<String, i64>,
|
||||
pub(crate) auto_compact_token_limit: Option<i64>,
|
||||
pub(crate) tool_output_token_limit: Option<usize>,
|
||||
pub(crate) base_instructions: Option<String>,
|
||||
@@ -185,6 +187,7 @@ impl From<ModelsManagerConfig> for ModelInfoOverrides {
|
||||
fn from(config: ModelsManagerConfig) -> Self {
|
||||
Self {
|
||||
context_window: config.model_context_window,
|
||||
context_windows: config.model_context_windows,
|
||||
auto_compact_token_limit: config.model_auto_compact_token_limit,
|
||||
tool_output_token_limit: config.tool_output_token_limit,
|
||||
base_instructions: config.base_instructions,
|
||||
@@ -199,6 +202,7 @@ impl ModelInfoOverrides {
|
||||
) -> ModelsManagerConfig {
|
||||
ModelsManagerConfig {
|
||||
model_context_window: self.context_window,
|
||||
model_context_windows: self.context_windows.clone(),
|
||||
model_auto_compact_token_limit: self.auto_compact_token_limit,
|
||||
tool_output_token_limit: self.tool_output_token_limit,
|
||||
base_instructions: self.base_instructions.clone(),
|
||||
|
||||
Reference in New Issue
Block a user