fix(ui): enable selection of zero-config providers in desktop GUI (#3378)

Signed-off-by: Kyle Santiago <kyle@privkey.io>
This commit is contained in:
Kyle 🐆
2025-07-20 20:44:49 -04:00
committed by GitHub
parent 947c2f5248
commit cfa99b3e08
8 changed files with 313 additions and 44 deletions
+22
View File
@@ -109,6 +109,13 @@ pub fn inspect_keys(
pub fn check_provider_configured(metadata: &ProviderMetadata) -> bool {
let config = Config::global();
// Special case: Zero-config providers (no config keys)
if metadata.config_keys.is_empty() {
// Check if the provider has been explicitly configured via the UI
let configured_marker = format!("{}_configured", metadata.name);
return config.get_param::<bool>(&configured_marker).is_ok();
}
// Get all required keys
let required_keys: Vec<&ConfigKey> = metadata
.config_keys
@@ -128,6 +135,21 @@ pub fn check_provider_configured(metadata: &ProviderMetadata) -> bool {
return is_set_in_env || is_set_in_config;
}
// Special case: If a provider has only optional keys with defaults,
// check if a configuration marker exists
if required_keys.is_empty() && !metadata.config_keys.is_empty() {
let all_optional_with_defaults = metadata
.config_keys
.iter()
.all(|key| !key.required && key.default.is_some());
if all_optional_with_defaults {
// Check if the provider has been explicitly configured via the UI
let configured_marker = format!("{}_configured", metadata.name);
return config.get_param::<bool>(&configured_marker).is_ok();
}
}
// For providers with multiple keys or keys without defaults:
// Find required keys that don't have default values
let required_non_default_keys: Vec<&ConfigKey> = required_keys