Skip to content

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

fix(search): handle empty query in querit tool

Steven Enamakelaea0181bbc85
diff --git a/crates/openhuman-core/src/search/tools/querit.rs b/crates/openhuman-core/src/search/tools/querit.rs
index acf2d110d7..84317b628d 100644
--- a/crates/openhuman-core/src/search/tools/querit.rs
+++ b/crates/openhuman-core/src/search/tools/querit.rs
@@ -515,6 +515,37 @@ impl Tool for QueritSearchTool {
result.markdown_formatted =
Some(self.render_results_markdown(&search_resp.results.result, query));
}
+ // Host-only structured payload for the chat UI's tool-call
+ // presentation — never rendered to the model, so `render_results_plain`'s
+ // text above (and the cache key that depends on it) is unaffected.
+ let snippets: Vec<Option<String>> = search_resp
+ .results
+ .result
+ .iter()
+ .map(super::querit::QueritResultItem::snippet_text)
+ .collect();
+ let structured_results: Vec<crate::search::tools::WebSearchResultRef<'_>> = search_resp
+ .results
+ .result
+ .iter()
+ .zip(snippets.iter())
+ .map(|(item, snippet)| crate::search::tools::WebSearchResultRef {
+ title: item
+ .title
+ .as_deref()
+ .filter(|t| !t.trim().is_empty())
+ .unwrap_or("Untitled"),
+ url: item.url.as_str(),
+ published: item.page_age.as_deref(),
+ excerpt: snippet.as_deref(),
+ })
+ .collect();
+ result.metadata = Some(crate::search::tools::web_search_metadata(
+ query,
+ "Querit",
+ &structured_results,
+ self.max_results,
+ ));
Ok(result)
}
}