diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx index 8254aa0..2b43302 100644 --- a/src/components/chat/ChatInput.tsx +++ b/src/components/chat/ChatInput.tsx @@ -325,6 +325,7 @@ export function ChatInput({ chatId }: { chatId?: number }) { onPaste={handlePaste} placeholder="Ask Dyad to build..." excludeCurrentApp={true} + disableSendButton={disableSendButton} /> {isStreaming ? ( diff --git a/src/components/chat/HomeChatInput.tsx b/src/components/chat/HomeChatInput.tsx index 51283b4..cbd91b0 100644 --- a/src/components/chat/HomeChatInput.tsx +++ b/src/components/chat/HomeChatInput.tsx @@ -86,6 +86,7 @@ export function HomeChatInput({ placeholder="Ask Dyad to build..." disabled={isStreaming} excludeCurrentApp={false} + disableSendButton={false} /> {/* File attachment dropdown */} diff --git a/src/components/chat/LexicalChatInput.tsx b/src/components/chat/LexicalChatInput.tsx index 9d28457..ed4780a 100644 --- a/src/components/chat/LexicalChatInput.tsx +++ b/src/components/chat/LexicalChatInput.tsx @@ -90,7 +90,13 @@ function CustomMenu({ loading: _loading, ...props }: any) { } // Plugin to handle Enter key -function EnterKeyPlugin({ onSubmit }: { onSubmit: () => void }) { +function EnterKeyPlugin({ + onSubmit, + disableSendButton, +}: { + onSubmit: () => void; + disableSendButton: boolean; +}) { const [editor] = useLexicalComposerContext(); useEffect(() => { @@ -109,7 +115,7 @@ function EnterKeyPlugin({ onSubmit }: { onSubmit: () => void }) { return false; } - if (!event.shiftKey) { + if (!event.shiftKey && !disableSendButton) { event.preventDefault(); onSubmit(); return true; @@ -118,7 +124,7 @@ function EnterKeyPlugin({ onSubmit }: { onSubmit: () => void }) { }, COMMAND_PRIORITY_HIGH, // Use higher priority to catch before mentions plugin ); - }, [editor, onSubmit]); + }, [editor, onSubmit, disableSendButton]); return null; } @@ -231,6 +237,7 @@ interface LexicalChatInputProps { placeholder?: string; disabled?: boolean; excludeCurrentApp: boolean; + disableSendButton: boolean; } function onError(error: Error) { @@ -245,6 +252,7 @@ export function LexicalChatInput({ excludeCurrentApp, placeholder = "Ask Dyad to build...", disabled = false, + disableSendButton, }: LexicalChatInputProps) { const { apps } = useLoadApps(); const { prompts } = usePrompts(); @@ -402,7 +410,10 @@ export function LexicalChatInput({ /> - +