Remove default AI providers and models
This commit is contained in:
@@ -735,7 +735,6 @@ impl LLMPreferences {
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
{
|
||||
Self::ensure_default_chatgpt_models_in_settings(ctx);
|
||||
me.refresh_bedrock_models(ctx);
|
||||
me.inject_openai_models(ctx);
|
||||
me.ensure_default_model_present();
|
||||
@@ -747,44 +746,6 @@ impl LLMPreferences {
|
||||
me
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
fn ensure_default_chatgpt_models_in_settings(ctx: &mut ModelContext<Self>) {
|
||||
let mut providers = AISettings::as_ref(ctx).openai_providers.value().clone();
|
||||
let default_chatgpt_models = crate::settings::ai::default_chatgpt_provider().models;
|
||||
let mut providers_changed = false;
|
||||
for provider in &mut providers {
|
||||
if provider.kind != OpenAIProviderKind::ChatGPTSubscription {
|
||||
continue;
|
||||
}
|
||||
|
||||
if provider.models.is_empty() {
|
||||
provider.models = default_chatgpt_models.clone();
|
||||
providers_changed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
for model in &mut provider.models {
|
||||
if !model.reasoning_efforts.is_empty() {
|
||||
continue;
|
||||
}
|
||||
if let Some(default_model) = default_chatgpt_models
|
||||
.iter()
|
||||
.find(|default_model| default_model.model_id == model.model_id)
|
||||
{
|
||||
if !default_model.reasoning_efforts.is_empty() {
|
||||
model.reasoning_efforts = default_model.reasoning_efforts.clone();
|
||||
providers_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if providers_changed {
|
||||
AISettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
let _ = settings.openai_providers.set_value(providers, ctx);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
fn refresh_bedrock_models(&mut self, ctx: &mut ModelContext<Self>) {
|
||||
let settings = AISettings::as_ref(ctx);
|
||||
|
||||
@@ -724,101 +724,6 @@ fn disabled_providers_do_not_leave_models_in_the_runtime_inventory() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chatgpt_reasoning_modes_route_with_catalog_context_metadata() {
|
||||
App::test((), |mut app| async move {
|
||||
initialize_settings_for_tests(&mut app);
|
||||
let provider = crate::settings::ai::default_chatgpt_provider();
|
||||
let configured_model = |model_id: &str| {
|
||||
provider
|
||||
.models
|
||||
.iter()
|
||||
.find(|model| model.model_id == model_id)
|
||||
.expect("ChatGPT model should be configured")
|
||||
};
|
||||
|
||||
let gpt_54 = configured_model("gpt-5.4");
|
||||
assert_eq!(gpt_54.context_size, 1_000_000);
|
||||
assert_eq!(gpt_54.max_input_tokens, Some(950_000));
|
||||
let gpt_56_sol = configured_model("gpt-5.6-sol");
|
||||
assert_eq!(gpt_56_sol.context_size, 272_000);
|
||||
assert_eq!(gpt_56_sol.max_input_tokens, Some(258_400));
|
||||
let uncached_model = configured_model("gpt-5.4-pro");
|
||||
assert_eq!(uncached_model.context_size, 200_000);
|
||||
assert_eq!(uncached_model.max_input_tokens, None);
|
||||
|
||||
AISettings::handle(&app).update(&mut app, |settings, ctx| {
|
||||
settings
|
||||
.bedrock_enabled
|
||||
.set_value(false, ctx)
|
||||
.expect("Bedrock setting should update");
|
||||
settings
|
||||
.acp_enabled
|
||||
.set_value(false, ctx)
|
||||
.expect("ACP setting should update");
|
||||
settings
|
||||
.openai_enabled
|
||||
.set_value(true, ctx)
|
||||
.expect("OpenAI setting should update");
|
||||
settings
|
||||
.openai_models
|
||||
.set_value(Vec::new(), ctx)
|
||||
.expect("OpenAI model setting should update");
|
||||
settings
|
||||
.openai_providers
|
||||
.set_value(vec![provider], ctx)
|
||||
.expect("OpenAI provider setting should update");
|
||||
});
|
||||
|
||||
let mut preferences = empty_preferences();
|
||||
app.read(|ctx| preferences.inject_openai_models(ctx));
|
||||
|
||||
let model_info = |model_id: &str| {
|
||||
preferences
|
||||
.models_by_feature
|
||||
.agent_mode
|
||||
.choices
|
||||
.iter()
|
||||
.find(|model| model.id.as_str() == model_id)
|
||||
.expect("ChatGPT model should be available")
|
||||
};
|
||||
let assert_fixed_context = |model_id: &str, expected: u32| {
|
||||
let context_window = &model_info(model_id).context_window;
|
||||
assert!(!context_window.is_configurable);
|
||||
assert_eq!(context_window.min, expected);
|
||||
assert_eq!(context_window.max, expected);
|
||||
assert_eq!(context_window.default_max, expected);
|
||||
};
|
||||
|
||||
let mode_id = "gpt-5.4::reasoning::high";
|
||||
let mode = model_info(mode_id);
|
||||
assert_eq!(mode.reasoning_level.as_deref(), Some("high"));
|
||||
assert_fixed_context(mode_id, 950_000);
|
||||
let routing = preferences
|
||||
.openai_client_config_for_model(mode_id)
|
||||
.expect("reasoning mode should have a routing entry");
|
||||
assert_eq!(routing.model.as_deref(), Some("gpt-5.4"));
|
||||
assert_eq!(routing.reasoning_effort.as_deref(), Some("high"));
|
||||
assert_eq!(routing.max_input_tokens, Some(950_000));
|
||||
|
||||
let ultra_id = "gpt-5.6-sol::reasoning::ultra";
|
||||
assert_fixed_context(ultra_id, 258_400);
|
||||
let ultra_routing = preferences
|
||||
.openai_client_config_for_model(ultra_id)
|
||||
.expect("GPT-5.6 Sol ultra mode should have a routing entry");
|
||||
assert_eq!(ultra_routing.model.as_deref(), Some("gpt-5.6-sol"));
|
||||
assert_eq!(ultra_routing.reasoning_effort.as_deref(), Some("ultra"));
|
||||
assert_eq!(ultra_routing.max_input_tokens, Some(258_400));
|
||||
|
||||
let uncached_id = "gpt-5.4-pro";
|
||||
assert_fixed_context(uncached_id, 200_000);
|
||||
let uncached_routing = preferences
|
||||
.openai_client_config_for_model(uncached_id)
|
||||
.expect("GPT-5.4 Pro should have a routing entry");
|
||||
assert_eq!(uncached_routing.max_input_tokens, Some(200_000));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn provider_discovery_enables_rig_for_new_models_and_keeps_manual_models() {
|
||||
let manual = openai_model("manual-model");
|
||||
|
||||
Reference in New Issue
Block a user