FrederickSundeep commited on
Commit
c70ad0c
·
1 Parent(s): 18043e6

commit 0211511111

Browse files
Files changed (2) hide show
  1. src/App.js +2 -1
  2. src/components/ChatInput.jsx +2 -2
src/App.js CHANGED
@@ -45,6 +45,7 @@ export default function App() {
45
  },
46
  onDone: () => {
47
  setLoading(false);
 
48
  },
49
  });
50
  };
@@ -89,7 +90,7 @@ export default function App() {
89
  setResetKey((k) => k + 1);
90
  }}>Clear Chat</button>
91
  </div>
92
- <ChatInput onSend={handleSend} fileUploaded={fileUploaded}/>
93
  </div>
94
  </div>
95
  );
 
45
  },
46
  onDone: () => {
47
  setLoading(false);
48
+ setFileUploaded(false);
49
  },
50
  });
51
  };
 
90
  setResetKey((k) => k + 1);
91
  }}>Clear Chat</button>
92
  </div>
93
+ <ChatInput onSend={handleSend} fileUploaded={!fileUploaded}/>
94
  </div>
95
  </div>
96
  );
src/components/ChatInput.jsx CHANGED
@@ -4,7 +4,7 @@ export default function ChatInput({ onSend, fileUploaded }) {
4
  const [input, setInput] = useState("");
5
 
6
  const handleSubmit = () => {
7
- // if (!input.trim() || !fileUploaded) return;
8
  onSend(input);
9
  setInput("");
10
  };
@@ -25,7 +25,7 @@ export default function ChatInput({ onSend, fileUploaded }) {
25
  disabled={isInputDisabled} // disable typing if no file
26
  onKeyDown={(e) => e.key === "Enter" && !isButtonDisabled && handleSubmit()}
27
  />
28
- <button onClick={handleSubmit} disabled={!isButtonDisabled}>Send</button>
29
  </div>
30
  );
31
  }
 
4
  const [input, setInput] = useState("");
5
 
6
  const handleSubmit = () => {
7
+ if (!input.trim() || fileUploaded) return;
8
  onSend(input);
9
  setInput("");
10
  };
 
25
  disabled={isInputDisabled} // disable typing if no file
26
  onKeyDown={(e) => e.key === "Enter" && !isButtonDisabled && handleSubmit()}
27
  />
28
+ <button onClick={handleSubmit} disabled={isButtonDisabled}>Send</button>
29
  </div>
30
  );
31
  }