Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix (ai): jpeg dss images fail (#67)
Eric Hayesaeef9d65ec60
diff --git a/rust/cloud-storage/document_cognition_service/src/service/ai/attachments.rs b/rust/cloud-storage/document_cognition_service/src/service/ai/attachments.rsdeleted file mode 100644index 9771d17a6d..0000000000--- a/rust/cloud-storage/document_cognition_service/src/service/ai/attachments.rs+++ /dev/null@@ -1,45 +0,0 @@-use crate::api::context::ApiContext;-use crate::service::attachment::document::get_document_plaintext_content;-use ai::types::PromptAttachment;-use anyhow::Context;-use anyhow::Result;-use model::chat::{AttachmentType, ChatAttachmentWithName};-use std::sync::Arc;--#[tracing::instrument(err, skip(ctx))]-pub async fn build_prompt_attachments(- attachments: Vec<ChatAttachmentWithName>,- ctx: Arc<ApiContext>,-) -> Result<Vec<PromptAttachment>> {- let requests =- attachments- .into_iter()- .flat_map(|attachment| match attachment.attachment_type {- AttachmentType::Document => Some(get_attachment_document(ctx.clone(), attachment)),- _ => None,- });- futures::future::try_join_all(requests).await-}--#[tracing::instrument(err, skip(ctx))]-async fn get_attachment_document(- ctx: Arc<ApiContext>,- attachment: ChatAttachmentWithName,-) -> Result<PromptAttachment> {- let document_content = get_document_plaintext_content(&ctx, &attachment.attachment_id)- .await- .context("Failed to get document plaintext content")?;-- let file_type = document_content.file_type;- let document_name = document_content.metadata().document_name.clone();- let content = document_content- .text_content()- .context("Failed to extract text content from document")?;-- Ok(PromptAttachment {- id: attachment.attachment_id.clone(),- file_type: file_type.to_string(),- name: document_name,- content,- })-}diff --git a/rust/cloud-storage/document_cognition_service/src/service/ai/mod.rs b/rust/cloud-storage/document_cognition_service/src/service/ai/mod.rsindex 57af878953..c427f91ac7 100644--- a/rust/cloud-storage/document_cognition_service/src/service/ai/mod.rs+++ b/rust/cloud-storage/document_cognition_service/src/service/ai/mod.rs@@ -1,2 +1 @@-pub mod attachments;pub mod name;diff --git a/rust/cloud-storage/document_cognition_service/src/service/attachment/fetch.rs b/rust/cloud-storage/document_cognition_service/src/service/attachment/fetch.rsindex f66d9f4e42..6732b7ac63 100644--- a/rust/cloud-storage/document_cognition_service/src/service/attachment/fetch.rs+++ b/rust/cloud-storage/document_cognition_service/src/service/attachment/fetch.rs@@ -58,7 +58,6 @@ pub async fn fetchium(.document_content().await.context("failed to fetch document content")?;-if document.file_type().is_image() {Ok(Attachment::ImageUrl(document.content.base64_image_content()?,diff --git a/rust/cloud-storage/model/src/document/file_type/mod.rs b/rust/cloud-storage/model/src/document/file_type/mod.rsindex baf9318802..0729bcdff4 100644--- a/rust/cloud-storage/model/src/document/file_type/mod.rs+++ b/rust/cloud-storage/model/src/document/file_type/mod.rs@@ -684,7 +684,7 @@ impl FileType {pub fn is_image(&self) -> bool {matches!(self,- FileType::Png | FileType::Jpg | FileType::Gif | FileType::Svg+ FileType::Png | FileType::Jpg | FileType::Gif | FileType::Svg | FileType::Jpeg)}diff --git a/rust/cloud-storage/scribe/src/document/types.rs b/rust/cloud-storage/scribe/src/document/types.rsindex e1d7fa03e8..60b71cac73 100644--- a/rust/cloud-storage/scribe/src/document/types.rs+++ b/rust/cloud-storage/scribe/src/document/types.rs@@ -13,13 +13,23 @@ pub struct DocumentContent {pub location: LocationResponseV3,}-#[derive(Clone, Debug)]+#[derive(Clone)]pub enum Data {Text(String),Binary(Bytes),Markdown(CognitionResponseData),}+impl std::fmt::Debug for Data {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ match self {+ Data::Binary(bytes) => write!(f, "Data::Binary(<{} bytes>)", bytes.len()),+ Data::Text(chars) => write!(f, "Data::Text(<{} characters>)", chars.len()),+ Data::Markdown(nodes) => write!(f, "Data::Markdown(<{} nodes>)", nodes.data.len()),+ }+ }+}+impl DocumentContent {pub fn metadata(&self) -> &DocumentBasic {self.location.metadata()