Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(agent): prefix web_search/web_fetch errors with 'ERROR' so the model does not silently treat them as successful results (#8511)

automaticcat3e842b7842c8
diff --git a/src-tauri/src/core/agent/tools/web.rs b/src-tauri/src/core/agent/tools/web.rs
index 3cbb54240..0b5b29bf8 100644
--- a/src-tauri/src/core/agent/tools/web.rs
+++ b/src-tauri/src/core/agent/tools/web.rs
@@ -57,7 +57,7 @@ pub async fn web_search(args: &Value) -> String {
format!("No web search results found for query: {query}")
}
Ok(results) => render_search_results(&results),
- Err(e) => e,
+ Err(e) => format!("ERROR: {e}"),
}
}
@@ -79,7 +79,7 @@ pub async fn web_fetch(args: &Value) -> String {
};
match provider.fetch(url).await {
Ok(page) => render_fetched_page(&page),
- Err(e) => e,
+ Err(e) => format!("ERROR: {e}"),
}
}