build(cli)!: add owlen-code binary and wire code mode
This commit is contained in:
@@ -195,13 +195,13 @@ async fn list_models(filter: Option<&str>) -> Result<()> {
|
||||
}
|
||||
|
||||
fn verify_provider_filter(config: &Config, filter: Option<&str>) -> Result<()> {
|
||||
if let Some(filter) = filter {
|
||||
if !config.providers.contains_key(filter) {
|
||||
return Err(anyhow!(
|
||||
"Provider '{}' is not defined in configuration.",
|
||||
filter
|
||||
));
|
||||
}
|
||||
if let Some(filter) = filter
|
||||
&& !config.providers.contains_key(filter)
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"Provider '{}' is not defined in configuration.",
|
||||
filter
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -254,10 +254,10 @@ fn toggle_provider(provider: &str, enable: bool) -> Result<()> {
|
||||
entry.enabled = previous_enabled;
|
||||
}
|
||||
config.general.default_provider = previous_default;
|
||||
if let Some(enabled) = previous_fallback_enabled {
|
||||
if let Some(entry) = config.providers.get_mut("ollama_local") {
|
||||
entry.enabled = enabled;
|
||||
}
|
||||
if let Some(enabled) = previous_fallback_enabled
|
||||
&& let Some(entry) = config.providers.get_mut("ollama_local")
|
||||
{
|
||||
entry.enabled = enabled;
|
||||
}
|
||||
return Err(anyhow!(err));
|
||||
}
|
||||
@@ -273,12 +273,11 @@ fn toggle_provider(provider: &str, enable: bool) -> Result<()> {
|
||||
}
|
||||
|
||||
fn choose_fallback_provider(config: &Config, exclude: &str) -> Option<String> {
|
||||
if exclude != "ollama_local" {
|
||||
if let Some(cfg) = config.providers.get("ollama_local") {
|
||||
if cfg.enabled {
|
||||
return Some("ollama_local".to_string());
|
||||
}
|
||||
}
|
||||
if exclude != "ollama_local"
|
||||
&& let Some(cfg) = config.providers.get("ollama_local")
|
||||
&& cfg.enabled
|
||||
{
|
||||
return Some("ollama_local".to_string());
|
||||
}
|
||||
|
||||
let mut candidates: Vec<String> = config
|
||||
@@ -300,10 +299,10 @@ async fn register_enabled_providers(
|
||||
let mut records = Vec::new();
|
||||
|
||||
for (id, cfg) in &config.providers {
|
||||
if let Some(filter) = filter {
|
||||
if id != filter {
|
||||
continue;
|
||||
}
|
||||
if let Some(filter) = filter
|
||||
&& id != filter
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut record = ProviderRecord::from_config(id, cfg, id == &default_provider);
|
||||
@@ -537,10 +536,10 @@ fn print_models(
|
||||
} else {
|
||||
for entry in entries {
|
||||
let mut line = format!(" - {}", entry.model.name);
|
||||
if let Some(description) = &entry.model.description {
|
||||
if !description.trim().is_empty() {
|
||||
line.push_str(&format!(" — {}", description.trim()));
|
||||
}
|
||||
if let Some(description) = &entry.model.description
|
||||
&& !description.trim().is_empty()
|
||||
{
|
||||
line.push_str(&format!(" — {}", description.trim()));
|
||||
}
|
||||
println!("{}", line);
|
||||
}
|
||||
@@ -549,10 +548,10 @@ fn print_models(
|
||||
println!(" (no models reported)");
|
||||
}
|
||||
|
||||
if let Some(ProviderStatus::RequiresSetup) = status_value {
|
||||
if record.requires_auth {
|
||||
println!(" configure provider credentials or API key");
|
||||
}
|
||||
if let Some(ProviderStatus::RequiresSetup) = status_value
|
||||
&& record.requires_auth
|
||||
{
|
||||
println!(" configure provider credentials or API key");
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user