diff --git a/crates/assistant_tools/src/fetch_tool.rs b/crates/assistant_tools/src/fetch_tool.rs index c8fa600e83..54d49359ba 100644 --- a/crates/assistant_tools/src/fetch_tool.rs +++ b/crates/assistant_tools/src/fetch_tool.rs @@ -69,10 +69,9 @@ impl FetchTool { .to_str() .context("invalid Content-Type header")?; let content_type = match content_type { - "text/html" => ContentType::Html, - "text/plain" => ContentType::Plaintext, + "text/html" | "application/xhtml+xml" => ContentType::Html, "application/json" => ContentType::Json, - _ => ContentType::Html, + _ => ContentType::Plaintext, }; match content_type { diff --git a/crates/html_to_markdown/src/markdown_writer.rs b/crates/html_to_markdown/src/markdown_writer.rs index a9caf7afa7..c32205ae7b 100644 --- a/crates/html_to_markdown/src/markdown_writer.rs +++ b/crates/html_to_markdown/src/markdown_writer.rs @@ -119,8 +119,10 @@ impl MarkdownWriter { .push_back(current_element.clone()); } - for child in node.children.borrow().iter() { - self.visit_node(child, handlers)?; + if self.current_element_stack.len() < 200 { + for child in node.children.borrow().iter() { + self.visit_node(child, handlers)?; + } } if let Some(current_element) = current_element {