fix: loading card

feat/course
Arik Chakma 2 months ago
parent 0e44c85377
commit 2cd8b52fad
  1. 6
      src/components/CourseAI/CourseAIPopover.tsx

@ -69,6 +69,7 @@ export function CourseAIPopover(props: CourseAIPopoverProps) {
setMessage(''); setMessage('');
}); });
scrollToBottom();
completeCourseAIChat(newMessages); completeCourseAIChat(newMessages);
}; };
@ -181,6 +182,10 @@ export function CourseAIPopover(props: CourseAIPopoverProps) {
); );
})} })}
{isLoading && !streamedMessage && (
<AIChatCard role="assistant" content="Thinking..." />
)}
{streamedMessage && ( {streamedMessage && (
<AIChatCard role="assistant" content={streamedMessage} /> <AIChatCard role="assistant" content={streamedMessage} />
)} )}
@ -198,6 +203,7 @@ export function CourseAIPopover(props: CourseAIPopoverProps) {
placeholder="Ask AI anything about the course..." placeholder="Ask AI anything about the course..."
value={message} value={message}
onChange={(e) => setMessage(e.target.value)} onChange={(e) => setMessage(e.target.value)}
autoFocus={true}
/> />
<button <button
type="submit" type="submit"

Loading…
Cancel
Save