Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(chat): allow sending with only an image attached (macro-1912) (#4199)

Eric Hayes7a8d0ae93a52
diff --git a/js/app/packages/core/component/AI/component/input/ChatInput.tsx b/js/app/packages/core/component/AI/component/input/ChatInput.tsx
index b4d0390d0e..e48b6ea36d 100644
--- a/js/app/packages/core/component/AI/component/input/ChatInput.tsx
+++ b/js/app/packages/core/component/AI/component/input/ChatInput.tsx
@@ -124,9 +124,12 @@ export function ChatInput(props: ChatInputComponentProps) {
});
const isEmptyInput = () => markdownText().trim().length === 0;
+ const hasAttachedFiles = () => attachments.attached().length > 0;
const hasUploadingAttachments = () => uploadQueue.uploading().length > 0;
const canSendMessage = () =>
- !isEmptyInput() && !generating() && !hasUploadingAttachments();
+ (!isEmptyInput() || hasAttachedFiles()) &&
+ !generating() &&
+ !hasUploadingAttachments();
const LINE_HEIGHT_THRESHOLD = 40;
let mdRef: undefined | HTMLDivElement;
diff --git a/js/app/packages/core/component/AI/component/message/UserMessage.tsx b/js/app/packages/core/component/AI/component/message/UserMessage.tsx
index ed988b646e..fcd2360d45 100644
--- a/js/app/packages/core/component/AI/component/message/UserMessage.tsx
+++ b/js/app/packages/core/component/AI/component/message/UserMessage.tsx
@@ -60,7 +60,7 @@ export function UserMessage(props: {
const content = () => {
const rawContent = cn()[1];
- return rawContent || undefined;
+ return rawContent?.trim() ? rawContent : undefined;
};
const imageAttachments = () =>