Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/goose-cli/src/commands/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ pub async fn run_benchmark(

let config = Config::global();
let goose_model: String = config
.get("GOOSE_MODEL")
.get_param("GOOSE_MODEL")
.expect("No model configured. Run 'goose configure' first");
let provider_name: String = config
.get("GOOSE_PROVIDER")
.get_param("GOOSE_PROVIDER")
.expect("No provider configured. Run 'goose configure' first");

let mut results = BenchmarkResults::new(provider_name.clone());
Expand Down
26 changes: 13 additions & 13 deletions crates/goose-cli/src/commands/configure.rs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just renamed get to get_param and set to set_param

Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
.collect();

// Get current default provider if it exists
let current_provider: Option<String> = config.get("GOOSE_PROVIDER").ok();
let current_provider: Option<String> = config.get_param("GOOSE_PROVIDER").ok();
let default_provider = current_provider.unwrap_or_default();

// Select provider
Expand Down Expand Up @@ -219,7 +219,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
if key.secret {
config.set_secret(&key.name, Value::String(env_value))?;
} else {
config.set(&key.name, Value::String(env_value))?;
config.set_param(&key.name, Value::String(env_value))?;
}
let _ = cliclack::log::info(format!("Saved {} to config file", key.name));
}
Expand All @@ -229,7 +229,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
let existing: Result<String, _> = if key.secret {
config.get_secret(&key.name)
} else {
config.get(&key.name)
config.get_param(&key.name)
};

match existing {
Expand All @@ -252,7 +252,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
if key.secret {
config.set_secret(&key.name, Value::String(new_value))?;
} else {
config.set(&key.name, Value::String(new_value))?;
config.set_param(&key.name, Value::String(new_value))?;
}
}
}
Expand All @@ -278,7 +278,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
if key.secret {
config.set_secret(&key.name, Value::String(value))?;
} else {
config.set(&key.name, Value::String(value))?;
config.set_param(&key.name, Value::String(value))?;
}
}
}
Expand Down Expand Up @@ -325,8 +325,8 @@ 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()))?;
config.set_param("GOOSE_PROVIDER", Value::String(provider_name.to_string()))?;
config.set_param("GOOSE_MODEL", Value::String(model.clone()))?;
cliclack::outro("Configuration saved successfully")?;
Ok(true)
}
Expand Down Expand Up @@ -708,15 +708,15 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {

match mode {
"auto" => {
config.set("GOOSE_MODE", Value::String("auto".to_string()))?;
config.set_param("GOOSE_MODE", Value::String("auto".to_string()))?;
cliclack::outro("Set to Auto Mode - full file modification enabled")?;
}
"approve" => {
config.set("GOOSE_MODE", Value::String("approve".to_string()))?;
config.set_param("GOOSE_MODE", Value::String("approve".to_string()))?;
cliclack::outro("Set to Approve Mode - modifications require approval")?;
}
"chat" => {
config.set("GOOSE_MODE", Value::String("chat".to_string()))?;
config.set_param("GOOSE_MODE", Value::String("chat".to_string()))?;
cliclack::outro("Set to Chat Mode - no tools or modifications enabled")?;
}
_ => unreachable!(),
Expand All @@ -738,15 +738,15 @@ pub fn configure_tool_output_dialog() -> Result<(), Box<dyn Error>> {

match tool_log_level {
"high" => {
config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.8))?;
config.set_param("GOOSE_CLI_MIN_PRIORITY", Value::from(0.8))?;
cliclack::outro("Showing tool output of high importance only.")?;
}
"medium" => {
config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.2))?;
config.set_param("GOOSE_CLI_MIN_PRIORITY", Value::from(0.2))?;
cliclack::outro("Showing tool output of medium importance.")?;
}
"all" => {
config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.0))?;
config.set_param("GOOSE_CLI_MIN_PRIORITY", Value::from(0.0))?;
cliclack::outro("Showing all tool output.")?;
}
_ => unreachable!(),
Expand Down
6 changes: 3 additions & 3 deletions crates/goose-cli/src/session/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ pub async fn build_session(
let config = Config::global();

let provider_name: String = config
.get("GOOSE_PROVIDER")
.get_param("GOOSE_PROVIDER")
.expect("No provider configured. Run 'goose configure' first");

let model: String = config
.get("GOOSE_MODEL")
.get_param("GOOSE_MODEL")
.expect("No model configured. Run 'goose configure' first");
let model_config = goose::model::ModelConfig::new(model.clone());
let provider =
Expand Down Expand Up @@ -137,7 +137,7 @@ pub async fn build_session(
.await;

// Only override system prompt if a system override exists
let system_prompt_file: Option<String> = config.get("GOOSE_SYSTEM_PROMPT_FILE_PATH").ok();
let system_prompt_file: Option<String> = config.get_param("GOOSE_SYSTEM_PROMPT_FILE_PATH").ok();
if let Some(ref path) = system_prompt_file {
let override_prompt =
std::fs::read_to_string(path).expect("Failed to read system prompt file");
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-cli/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl Session {
}

config
.set("GOOSE_MODE", Value::String(mode.to_string()))
.set_param("GOOSE_MODE", Value::String(mode.to_string()))
.unwrap();
println!("Goose mode set to '{}'", mode);
continue;
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-cli/src/session/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fn render_tool_response(resp: &ToolResponse, theme: Theme, debug: bool) {
}

let min_priority = config
.get::<f32>("GOOSE_CLI_MIN_PRIORITY")
.get_param::<f32>("GOOSE_CLI_MIN_PRIORITY")
.ok()
.unwrap_or(0.0);

Expand Down
13 changes: 11 additions & 2 deletions crates/goose-server/src/openapi.rs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more routes and schemas so openapi can create client-side functions for the UI to use to avoid needing to generate the types and client functions to call the backend.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use utoipa::OpenApi;

use goose::providers::base::ConfigKey;
use goose::providers::base::ProviderMetadata;

#[allow(dead_code)] // Used by utoipa for OpenAPI generation
#[derive(OpenApi)]
#[openapi(
Expand All @@ -10,13 +13,19 @@ use utoipa::OpenApi;
super::routes::config_management::add_extension,
super::routes::config_management::remove_extension,
super::routes::config_management::update_extension,
super::routes::config_management::read_all_config
super::routes::config_management::read_all_config,
super::routes::config_management::providers
),
components(schemas(
super::routes::config_management::UpsertConfigQuery,
super::routes::config_management::ConfigKeyQuery,
super::routes::config_management::ExtensionQuery,
super::routes::config_management::ConfigResponse
super::routes::config_management::ConfigResponse,
super::routes::config_management::ProvidersResponse,
super::routes::config_management::ProvidersResponse,
super::routes::config_management::ProviderDetails,
ProviderMetadata,
ConfigKey
))
)]
pub struct ApiDoc;
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-server/src/routes/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async fn create_agent(
let config = Config::global();
let model = payload.model.unwrap_or_else(|| {
config
.get("GOOSE_MODEL")
.get_param("GOOSE_MODEL")
.expect("Did not find a model on payload or in env")
});
let model_config = ModelConfig::new(model);
Expand Down
Loading
Loading