From 5d3249848ddad7ad2174acb00cc7a083517f1c28 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 25 Feb 2025 01:40:17 -0800 Subject: [PATCH] refac: allow image only message via enter --- src/lib/components/chat/MessageInput.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index bf2f5cddb..df07cb493 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -828,7 +828,11 @@ } // Submit the prompt when Enter key is pressed - if (prompt !== '' && e.keyCode === 13 && !e.shiftKey) { + if ( + (prompt !== '' || files.length > 0) && + e.keyCode === 13 && + !e.shiftKey + ) { dispatch('submit', prompt); } } @@ -907,7 +911,11 @@ } // Submit the prompt when Enter key is pressed - if (prompt !== '' && e.key === 'Enter' && !e.shiftKey) { + if ( + (prompt !== '' || files.length > 0) && + e.key === 'Enter' && + !e.shiftKey + ) { dispatch('submit', prompt); } }