Skip to content

Commit

Permalink
fix: small fixes (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
baxen authored Jan 21, 2025
1 parent 1adb823 commit 97ad503
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 6 additions & 1 deletion crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use goose::providers::google::GOOGLE_DEFAULT_MODEL;
use goose::providers::groq::GROQ_DEFAULT_MODEL;
use goose::providers::ollama::OLLAMA_MODEL;
use goose::providers::openai::OPEN_AI_DEFAULT_MODEL;
use goose::providers::openrouter::OPENROUTER_DEFAULT_MODEL;
use std::collections::HashMap;
use std::error::Error;

Expand Down Expand Up @@ -98,6 +99,7 @@ pub async fn configure_provider_dialog(
"anthropic".to_string(),
"google".to_string(),
"groq".to_string(),
"openrouter".to_string(),
];
let provider = cliclack::select("Which model provider should we use?")
.initial_value(&config.default_provider)
Expand All @@ -107,7 +109,8 @@ pub async fn configure_provider_dialog(
(&providers[2], "Ollama", "Local open source models"),
(&providers[3], "Anthropic", "Claude models"),
(&providers[4], "Google Gemini", "Gemini models"),
(&providers[5], "Groq", "AI models"),
(&providers[5], "Groq", "Fast inference"),
(&providers[6], "OpenRouter", "Router for many models"),
])
.interact()?;
provider.to_string()
Expand Down Expand Up @@ -204,6 +207,7 @@ pub fn get_recommended_model(provider_name: &str) -> &str {
"anthropic" => ANTHROPIC_DEFAULT_MODEL,
"google" => GOOGLE_DEFAULT_MODEL,
"groq" => GROQ_DEFAULT_MODEL,
"openrouter" => OPENROUTER_DEFAULT_MODEL,
_ => panic!("Invalid provider name"),
}
}
Expand All @@ -216,6 +220,7 @@ pub fn get_required_keys(provider_name: &str) -> Vec<&'static str> {
"anthropic" => vec!["ANTHROPIC_API_KEY"],
"google" => vec!["GOOGLE_API_KEY"],
"groq" => vec!["GROQ_API_KEY"],
"openrouter" => vec!["OPENROUTER_API_KEY"],
_ => panic!("Invalid provider name"),
}
}
Expand Down
13 changes: 10 additions & 3 deletions crates/goose-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ enum Command {
#[arg(
short,
long,
required = true,
value_name = "FILE",
help = "Path to instruction file containing commands"
help = "Path to instruction file containing commands",
conflicts_with = "input_text"
)]
instructions: Option<String>,

Expand All @@ -129,7 +129,8 @@ enum Command {
long = "text",
value_name = "TEXT",
help = "Input text to provide to Goose directly",
long_help = "Input text containing commands for Goose. Use this in lieu of the instructions argument."
long_help = "Input text containing commands for Goose. Use this in lieu of the instructions argument.",
conflicts_with = "instructions"
)]
input_text: Option<String>,

Expand Down Expand Up @@ -246,6 +247,12 @@ async fn main() -> Result<()> {
agent,
resume,
}) => {
// Validate that we have some input source
if instructions.is_none() && input_text.is_none() {
eprintln!("Error: Must provide either --instructions or --text");
std::process::exit(1);
}

if let Some(agent_version) = agent.clone() {
if !AgentFactory::available_versions().contains(&agent_version.as_str()) {
eprintln!("Error: Invalid agent version '{}'", agent_version);
Expand Down
6 changes: 3 additions & 3 deletions crates/goose/src/agents/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Capabilities {
SystemConfig::Sse { ref uri, ref envs } => {
let transport = SseTransport::new(uri, envs.get_env());
let handle = transport.start().await?;
let service = McpService::with_timeout(handle, Duration::from_secs(100));
let service = McpService::with_timeout(handle, Duration::from_secs(300));
Box::new(McpClient::new(service))
}
SystemConfig::Stdio {
Expand All @@ -110,7 +110,7 @@ impl Capabilities {
} => {
let transport = StdioTransport::new(cmd, args.to_vec(), envs.get_env());
let handle = transport.start().await?;
let service = McpService::with_timeout(handle, Duration::from_secs(100));
let service = McpService::with_timeout(handle, Duration::from_secs(300));
Box::new(McpClient::new(service))
}
SystemConfig::Builtin { ref name } => {
Expand All @@ -126,7 +126,7 @@ impl Capabilities {
HashMap::new(),
);
let handle = transport.start().await?;
let service = McpService::with_timeout(handle, Duration::from_secs(100));
let service = McpService::with_timeout(handle, Duration::from_secs(300));
Box::new(McpClient::new(service))
}
};
Expand Down

0 comments on commit 97ad503

Please sign in to comment.