Spaces:
Runtime error
Runtime error
can send empty prompt
Browse files
components/input-generation.tsx
CHANGED
|
@@ -28,7 +28,12 @@ export const InputGeneration: React.FC = () => {
|
|
| 28 |
onChange={(e) => setValue(e.target.value)}
|
| 29 |
onBlur={() => setPrompt(value)}
|
| 30 |
onKeyDown={(e) => {
|
| 31 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
setPrompt(value);
|
| 33 |
setTimeout(() => {
|
| 34 |
submit();
|
|
@@ -46,7 +51,8 @@ export const InputGeneration: React.FC = () => {
|
|
| 46 |
}
|
| 47 |
)}
|
| 48 |
onClick={() => {
|
| 49 |
-
if ((!value && !prompt) || loading)
|
|
|
|
| 50 |
submit();
|
| 51 |
}}
|
| 52 |
>
|
|
|
|
| 28 |
onChange={(e) => setValue(e.target.value)}
|
| 29 |
onBlur={() => setPrompt(value)}
|
| 30 |
onKeyDown={(e) => {
|
| 31 |
+
if (
|
| 32 |
+
e.key === "Enter" &&
|
| 33 |
+
(value || prompt) &&
|
| 34 |
+
!loading &&
|
| 35 |
+
(value !== "" || prompt !== "")
|
| 36 |
+
) {
|
| 37 |
setPrompt(value);
|
| 38 |
setTimeout(() => {
|
| 39 |
submit();
|
|
|
|
| 51 |
}
|
| 52 |
)}
|
| 53 |
onClick={() => {
|
| 54 |
+
if ((!value && !prompt) || loading || value === "" || prompt === "")
|
| 55 |
+
return;
|
| 56 |
submit();
|
| 57 |
}}
|
| 58 |
>
|