Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(search): add provider registry for search backends

Steven Enamakel0c5f51354b1c
diff --git a/crates/openhuman-core/src/modules/search/mod.rs b/crates/openhuman-core/src/modules/search/mod.rs
index ddc90b995d..3b0416ac99 100644
--- a/crates/openhuman-core/src/modules/search/mod.rs
+++ b/crates/openhuman-core/src/modules/search/mod.rs
@@ -50,9 +50,11 @@ fn direct_settings(config: &Config, provider: &str) -> ProviderConfig {
settings.default_language = Some(config.searxng.default_language.clone());
}
other => {
- settings.credential = search
- .credentials(other)
- .and_then(|c| c.key())
+ // A key pinned on this agent's config wins over the stored one.
+ settings.credential = search.direct_key(other).map(str::to_owned);
+ settings.base_url = search
+ .host_credential(other)
+ .and_then(|pinned| pinned.base_url())
.map(str::to_owned);
}
}
diff --git a/crates/openhuman-core/src/search/providers.rs b/crates/openhuman-core/src/search/providers.rs
index 545fbad0ba..e98159ba2d 100644
--- a/crates/openhuman-core/src/search/providers.rs
+++ b/crates/openhuman-core/src/search/providers.rs
@@ -69,10 +69,8 @@ pub fn direct_configured(config: &Config, provider: &str) -> bool {
.as_deref()
.is_some_and(|key| !key.trim().is_empty()),
"searxng" => !config.searxng.base_url.trim().is_empty(),
- other => config
- .search
- .credentials(other)
- .is_some_and(|credentials| credentials.has_key()),
+ // A key an embedder pinned on this agent counts as well as a stored one.
+ other => config.search.direct_key(other).is_some(),
}
}