style: format seluruh workspace dengan cargo fmt
Menyeragamkan format kode sesuai rustfmt (126 file). Sebelumnya lefthook pre-commit 'cargo fmt --check' akan gagal pada commit apa pun.
This commit is contained in:
1 parent
884b19ccb5
commit
7b0b53671f
127 files changed
+1271
-1156
No files matched your search
@@ -75,8 +75,8 @@ impl Tool for WebSearch {
|
||||
|
||||
info!(query = %query, max_results, fetch_content, categories = %categories, "web search starting");
|
||||
|
||||
let searxng_url = std::env::var("SEARXNG_URL")
|
||||
.unwrap_or_else(|_| DEFAULT_SEARXNG_URL.to_string());
|
||||
let searxng_url =
|
||||
std::env::var("SEARXNG_URL").unwrap_or_else(|_| DEFAULT_SEARXNG_URL.to_string());
|
||||
|
||||
// Build the SearXNG JSON search URL
|
||||
let search_url = format!(
|
||||
@@ -138,10 +138,7 @@ impl Tool for WebSearch {
|
||||
.get("title")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("Untitled");
|
||||
let url = result
|
||||
.get("url")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("");
|
||||
let url = result.get("url").and_then(|v| v.as_str()).unwrap_or("");
|
||||
let snippet = result
|
||||
.get("content")
|
||||
.and_then(|v| v.as_str())
|
||||
@@ -176,7 +173,9 @@ impl Tool for WebSearch {
|
||||
|
||||
// Add suggestion for more specific queries if very few results
|
||||
if result_count < 3 {
|
||||
output.push_str("---\n*Few results. Try a more specific query or different categories.*\n");
|
||||
output.push_str(
|
||||
"---\n*Few results. Try a more specific query or different categories.*\n",
|
||||
);
|
||||
}
|
||||
|
||||
Ok(output)
|
||||
@@ -262,10 +261,7 @@ fn fetch_page_content(url: &str, client: &reqwest::blocking::Client) -> Result<S
|
||||
}
|
||||
|
||||
// Clean up whitespace
|
||||
let cleaned_text = text
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
let cleaned_text = text.split_whitespace().collect::<Vec<_>>().join(" ");
|
||||
|
||||
if cleaned_text.is_empty() {
|
||||
anyhow::bail!("no readable content found on page");
|
||||
@@ -276,8 +272,5 @@ fn fetch_page_content(url: &str, client: &reqwest::blocking::Client) -> Result<S
|
||||
|
||||
/// Limit a string to at most `max_lines` lines.
|
||||
fn limit_lines(s: &str, max_lines: usize) -> String {
|
||||
s.lines()
|
||||
.take(max_lines)
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
s.lines().take(max_lines).collect::<Vec<_>>().join("\n")
|
||||
}
|
||||
Reference in new issue
Block a user