Skip to content

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

fix(search): return owned provider label

Steven Enamakelab108d8364c6
diff --git a/crates/openhuman-core/src/config/ops/search.rs b/crates/openhuman-core/src/config/ops/search.rs
index f32507fbc9..261b3895c0 100644
--- a/crates/openhuman-core/src/config/ops/search.rs
+++ b/crates/openhuman-core/src/config/ops/search.rs
@@ -69,7 +69,7 @@ const LISTED_PROVIDERS: &[&str] = &[
];
fn label(provider: &str) -> String {
- tinysearch_bus::labels::provider_label(provider)
+ tinysearch_bus::labels::provider_label(provider).into_owned()
}
fn docs_url(provider: &str) -> Option<&'static str> {
diff --git a/crates/openhuman-core/src/search/render.rs b/crates/openhuman-core/src/search/render.rs
index cf9d5bfc3a..f4fb522af7 100644
--- a/crates/openhuman-core/src/search/render.rs
+++ b/crates/openhuman-core/src/search/render.rs
@@ -27,7 +27,8 @@ pub fn render(
let provider = provider_label(&response.provider);
let mut result = ToolResult::success(bus_render::render_text(response, subject, max_results));
if prefer_markdown {
- result.markdown_formatted = Some(bus_render::render_markdown(response, subject, max_results));
+ result.markdown_formatted =
+ Some(bus_render::render_markdown(response, subject, max_results));
}
result.metadata = Some(metadata(response, subject, &provider, max_results));
result
diff --git a/crates/openhuman-core/src/search/render_tests.rs b/crates/openhuman-core/src/search/render_tests.rs
index 860287bb71..01e521bfc3 100644
--- a/crates/openhuman-core/src/search/render_tests.rs
+++ b/crates/openhuman-core/src/search/render_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use tinysearch_bus::{Citation, SearchResult};
+use tinysearch_bus::{Citation, Role, SearchResult};
fn response(role: Option<Role>) -> ExecuteToolResponse {
ExecuteToolResponse {
@@ -106,6 +106,20 @@ fn results_are_capped_and_subject_reads_urls() {
"https://a, https://b"
);
assert_eq!(subject(&serde_json::json!({"query": " q "})), "q");
- assert_eq!(provider_label("searxng"), "SearXNG");
- assert_eq!(provider_label("custom"), "custom");
+}
+
+#[test]
+fn model_text_is_the_bus_rendering_byte_for_byte() {
+ let mut r = response(Some(Role::Answer));
+ r.answer = Some("An answer".into());
+ r.fallback_from = vec!["exa".into()];
+ let result = render(&r, "q", 5, true);
+ assert_eq!(
+ result.output(),
+ tinysearch_bus::render::render_text(&r, "q", 5)
+ );
+ assert_eq!(
+ result.markdown_formatted.as_deref(),
+ Some(tinysearch_bus::render::render_markdown(&r, "q", 5).as_str())
+ );
}