Skip to content

Commit

Permalink
fix: write to config yaml if provider test succeeds (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
salman1993 authored Feb 11, 2025
1 parent 9bb3f8d commit fdcf374
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
.default_input(&default_model)
.interact()?;

// Update config with new values
config.set("GOOSE_PROVIDER", Value::String(provider_name.to_string()))?;
config.set("GOOSE_MODEL", Value::String(model.clone()))?;

// Test the configuration
let spin = spinner();
spin.start("Checking your configuration...");
Expand Down Expand Up @@ -319,6 +315,9 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {

match result {
Ok((_message, _usage)) => {
// Update config with new values only if the test succeeds
config.set("GOOSE_PROVIDER", Value::String(provider_name.to_string()))?;
config.set("GOOSE_MODEL", Value::String(model.clone()))?;
cliclack::outro("Configuration saved successfully")?;
Ok(true)
}
Expand Down

0 comments on commit fdcf374

Please sign in to comment.