mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-19 07:04:21 +01:00
fix: write to config yaml if provider test succeeds (#1178)
This commit is contained in:
@@ -283,10 +283,6 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
|
|||||||
.default_input(&default_model)
|
.default_input(&default_model)
|
||||||
.interact()?;
|
.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
|
// Test the configuration
|
||||||
let spin = spinner();
|
let spin = spinner();
|
||||||
spin.start("Checking your configuration...");
|
spin.start("Checking your configuration...");
|
||||||
@@ -319,6 +315,9 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok((_message, _usage)) => {
|
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")?;
|
cliclack::outro("Configuration saved successfully")?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user