Jelajahi Sumber

refac: allow image only message via enter

Timothy Jaeryang Baek 2 bulan lalu
induk
melakukan
5d3249848d
1 mengubah file dengan 10 tambahan dan 2 penghapusan
  1. 10 2
      src/lib/components/chat/MessageInput.svelte

+ 10 - 2
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);
 													}
 												}