fix: activate custom provider after adding via configure (#9213)

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2026-05-18 09:52:33 -04:00
committed by GitHub
parent 64edb978cd
commit 7bce91e5eb
+17 -1
View File
@@ -2013,6 +2013,7 @@ fn collect_custom_headers() -> anyhow::Result<Option<std::collections::HashMap<S
}
fn add_provider() -> anyhow::Result<()> {
let config = Config::global();
let provider_type = cliclack::select("What type of API is this?")
.item(
"openai_compatible",
@@ -2097,7 +2098,7 @@ fn add_provider() -> anyhow::Result<()> {
let headers = collect_custom_headers()?;
create_custom_provider(CreateCustomProviderParams {
let provider_config = create_custom_provider(CreateCustomProviderParams {
engine: provider_type.to_string(),
display_name: display_name.clone(),
api_url,
@@ -2111,6 +2112,21 @@ fn add_provider() -> anyhow::Result<()> {
preserves_thinking: None,
})?;
if !provider_config.models.is_empty() {
let model_items: Vec<_> = provider_config
.models
.iter()
.map(|m| (m.name.as_str(), m.name.as_str(), ""))
.collect();
if let Ok(model) = cliclack::select("Which model should be the default?")
.items(&model_items)
.interact()
{
config.set_goose_provider(&provider_config.name)?;
config.set_goose_model(model)?;
}
}
cliclack::outro(format!("Custom provider added: {}", display_name))?;
Ok(())
}