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(chat): Attach email found from search (#555)
Eric Hayes45a485cecca5
diff --git a/js/app/packages/core/component/AI/signal/attachment.ts b/js/app/packages/core/component/AI/signal/attachment.tsindex 087cd633ef..8360bde0db 100644--- a/js/app/packages/core/component/AI/signal/attachment.ts+++ b/js/app/packages/core/component/AI/signal/attachment.ts@@ -85,7 +85,9 @@ export const useGetChatAttachmentInfo = () => {};};- const getChannelAttachment = (id: string): Attachment | undefined => {+ const getChannelAttachment = ({+ itemId: id,+ }: ItemMention): Attachment | undefined => {if (!ENABLE_CHAT_CHANNEL_ATTACHMENT) return;const item = channels().find((item) => item.id === id);@@ -103,30 +105,27 @@ export const useGetChatAttachmentInfo = () => {};};- const getEmailAttachment = (id: string): Attachment | undefined => {- const email = emails().find((e) => e.id === id);- if (!email) return;+ const getEmailAttachment = (mention: ItemMention): Attachment | undefined => {return {- id: `${id}-email-attachment`,- attachmentId: id,+ id: `${mention.itemId}-email-attachment`,+ attachmentId: mention.itemId,attachmentType: 'email',metadata: {type: 'email',- email_subject: email.name ?? 'No Subject',+ email_subject: mention.documentName ?? 'No Subject',},};};- const mentionToAttachment = ({- itemType,- itemId,- }: ItemMention): Attachment | undefined => {- if (itemType === 'document') {- return getDocumentAttachment(itemId);- } else if (itemType === 'channel') {- return getChannelAttachment(itemId);- } else if (itemType === 'email') {- return getEmailAttachment(itemId);+ const mentionToAttachment = (+ mention: ItemMention+ ): Attachment | undefined => {+ if (mention.itemType === 'document') {+ return getDocumentAttachment(mention.itemId);+ } else if (mention.itemType === 'channel') {+ return getChannelAttachment(mention);+ } else if (mention.itemType === 'email') {+ return getEmailAttachment(mention);}};