fix : Custom providers with empty API keys show as configured in desktop (#6105)
Signed-off-by: Abhijay007 <Abhijay007j@gmail.com>
This commit is contained in:
@@ -94,13 +94,11 @@ pub fn inspect_keys(
|
|||||||
pub fn check_provider_configured(metadata: &ProviderMetadata, provider_type: ProviderType) -> bool {
|
pub fn check_provider_configured(metadata: &ProviderMetadata, provider_type: ProviderType) -> bool {
|
||||||
let config = Config::global();
|
let config = Config::global();
|
||||||
|
|
||||||
// TODO(Douwe): if the provider doesn't need an API key, it should be considered configured always
|
|
||||||
if provider_type == ProviderType::Custom || provider_type == ProviderType::Declarative {
|
if provider_type == ProviderType::Custom || provider_type == ProviderType::Declarative {
|
||||||
if let Ok(loaded_provider) = load_provider(metadata.name.as_str()) {
|
if let Ok(loaded_provider) = load_provider(metadata.name.as_str()) {
|
||||||
return config
|
return config
|
||||||
.get_secret::<String>(&loaded_provider.config.api_key_env)
|
.get_secret::<String>(&loaded_provider.config.api_key_env)
|
||||||
.map(|s| !s.is_empty())
|
.is_ok();
|
||||||
.unwrap_or(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Special case: Zero-config providers (no config keys)
|
// Special case: Zero-config providers (no config keys)
|
||||||
|
|||||||
Reference in New Issue
Block a user