matt HOFFNER commited on
Commit
287282f
Β·
1 Parent(s): d5151b8
Files changed (1) hide show
  1. src/components/ChatWindow.jsx +5 -2
src/components/ChatWindow.jsx CHANGED
@@ -20,6 +20,7 @@ function ChatWindow({
20
  const { loadingStatus, send, isGenerating, deleteMessages } = useLLM();
21
  const [fileText, setFileText] = useState();
22
  const [userInput, setUserInput] = useState("");
 
23
 
24
  const handleChange = (event) => {
25
  setUserInput(event.target.value);
@@ -103,8 +104,10 @@ function ChatWindow({
103
  const loadFile = async (fileText) => {
104
  console.log('file loaded, demo mode');
105
  if (fileText) {
106
- const qaPrompt = await qaHandler(fileText, "Based on the context what are some interesting questions you can help answer");
 
107
  send(qaPrompt, maxTokens, stopStrings);
 
108
  }
109
  }
110
 
@@ -152,7 +155,7 @@ function ChatWindow({
152
  alt="Send Message"
153
  style={{
154
  filter:
155
- !isReady || isGenerating
156
  ? "grayscale(100%)"
157
  : undefined,
158
  }}
 
20
  const { loadingStatus, send, isGenerating, deleteMessages } = useLLM();
21
  const [fileText, setFileText] = useState();
22
  const [userInput, setUserInput] = useState("");
23
+ const [isLoading, setIsLoading] = useState(false);
24
 
25
  const handleChange = (event) => {
26
  setUserInput(event.target.value);
 
104
  const loadFile = async (fileText) => {
105
  console.log('file loaded, demo mode');
106
  if (fileText) {
107
+ setIsLoading(true);
108
+ const qaPrompt = await qaHandler(fileText, "Based on the context what are some interesting questions that I can ask you?");
109
  send(qaPrompt, maxTokens, stopStrings);
110
+ setIsLoading(false);
111
  }
112
  }
113
 
 
155
  alt="Send Message"
156
  style={{
157
  filter:
158
+ !isReady || isGenerating || isLoading
159
  ? "grayscale(100%)"
160
  : undefined,
161
  }}