fraudTech commited on
Commit
e44cd00
·
1 Parent(s): 6bfa6ea

thinking spinner fix

Browse files
Files changed (1) hide show
  1. web/src/App.tsx +5 -2
web/src/App.tsx CHANGED
@@ -248,6 +248,7 @@ function App() {
248
  const [messages, setMessages] = useState<Message[]>([]);
249
  const [input, setInput] = useState('');
250
  const [isLoading, setIsLoading] = useState(false);
 
251
  const [statusMessage, setStatusMessage] = useState('');
252
  const messagesEndRef = useRef<HTMLDivElement>(null);
253
  const messagesContainerRef = useRef<HTMLDivElement>(null);
@@ -318,6 +319,7 @@ function App() {
318
  const currentInput = input;
319
  setInput('');
320
  setIsLoading(true);
 
321
  setStatusMessage('Connecting to AI model...');
322
 
323
  // Create a temporary assistant message that will be updated
@@ -495,9 +497,10 @@ function App() {
495
  )
496
  );
497
  } else if (event === 'response') {
498
- // Final response - preserve error flags from existing tool calls
499
  setIsLoading(false);
500
  setStatusMessage('');
 
501
  setMessages((prev) =>
502
  prev.map((msg) =>
503
  msg.id === assistantId
@@ -794,7 +797,7 @@ function App() {
794
  </div>
795
  );
796
  })}
797
- {isLoading && (
798
  <div className="typing-indicator">
799
  <span></span>
800
  <span></span>
 
248
  const [messages, setMessages] = useState<Message[]>([]);
249
  const [input, setInput] = useState('');
250
  const [isLoading, setIsLoading] = useState(false);
251
+ const [responseComplete, setResponseComplete] = useState(false);
252
  const [statusMessage, setStatusMessage] = useState('');
253
  const messagesEndRef = useRef<HTMLDivElement>(null);
254
  const messagesContainerRef = useRef<HTMLDivElement>(null);
 
319
  const currentInput = input;
320
  setInput('');
321
  setIsLoading(true);
322
+ setResponseComplete(false);
323
  setStatusMessage('Connecting to AI model...');
324
 
325
  // Create a temporary assistant message that will be updated
 
497
  )
498
  );
499
  } else if (event === 'response') {
500
+ // Final response - this is the definitive completion signal
501
  setIsLoading(false);
502
  setStatusMessage('');
503
+ setResponseComplete(true);
504
  setMessages((prev) =>
505
  prev.map((msg) =>
506
  msg.id === assistantId
 
797
  </div>
798
  );
799
  })}
800
+ {isLoading && !responseComplete && (
801
  <div className="typing-indicator">
802
  <span></span>
803
  <span></span>