Skip to content

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

fix(attachments): gate document fallback on the documents feature

Steven Enamakel32cfb11142ff
diff --git a/crates/openhuman-core/src/attachments/provider_fallback.rs b/crates/openhuman-core/src/attachments/provider_fallback.rs
index f1f12a3f22..e75457eb91 100644
--- a/crates/openhuman-core/src/attachments/provider_fallback.rs
+++ b/crates/openhuman-core/src/attachments/provider_fallback.rs
@@ -6,8 +6,13 @@ impl AttachmentModel {
mime: &str,
bytes: &[u8],
) -> tinyinference_llm::Result<(String, bool)> {
+ #[cfg(feature = "documents")]
let mut cacheable = true;
+ #[cfg(not(feature = "documents"))]
+ let cacheable = false;
let mut text = String::new();
+ #[cfg(not(feature = "documents"))]
+ let _ = (path, mime, bytes);
#[cfg(feature = "documents")]
{
use tinydocs_bus::DocumentFormat;
diff --git a/crates/openhuman-core/src/attachments/provider_owner.rs b/crates/openhuman-core/src/attachments/provider_owner.rs
index ac40752a14..449c1b3916 100644
--- a/crates/openhuman-core/src/attachments/provider_owner.rs
+++ b/crates/openhuman-core/src/attachments/provider_owner.rs
@@ -173,17 +173,15 @@ impl MediaFallbackRenderer<AttachmentAccessScope> for AttachmentModel {
if let Some(text) = self.cached_fallback(&attachment.name, &key, _scope).await {
return Ok(Some(text));
}
- let (text, cacheable) = self.fallback(
- modality,
+ let (text, cacheable) = self.document_fallback(
&attachment.name,
&attachment.mime,
&attachment.bytes,
).await.map_err(|error| error.to_string())?;
- let body = text.split_once('\n').map(|(_, body)| body.to_owned()).unwrap_or(text);
if cacheable {
- self.save_fallback(&attachment.name, &key, &body, _scope).await;
+ self.save_fallback(&attachment.name, &key, &text, _scope).await;
}
- return Ok(Some(body));
+ return Ok(Some(text));
}
Ok(None)
}