use html2md on web_fetch (fixes #3)

This commit is contained in:
spqrz 2026-04-12 11:12:12 +01:00
parent d5aad5c1a4
commit e17c46edc1
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View file

@ -3,6 +3,7 @@ use std::sync::Arc;
use anyhow::{Context, Result};
use serde::Deserialize;
use html2md::parse_html;
pub fn tools() -> [super::Tool; 2] {
[
@ -42,7 +43,9 @@ async fn web_fetch(args: &serde_json::Value) -> Result<String> {
let body = response.text().await
.with_context(|| format!("failed to read body from {}", a.url))?;
Ok(super::truncate_output(body, 30000))
// Convert HTML to Markdown, then truncate
let markdown = parse_html(&body);
Ok(super::truncate_output(markdown, 30000))
}
// ── Search ──────────────────────────────────────────────────────