From 413748a224a0217d1a78b30fd8ca84d03fc6382a Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 24 Jun 2025 18:03:24 +0100 Subject: [PATCH] Update question answer chat --- .../ContentGenerator/QuestionAnswerChat.tsx | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/components/ContentGenerator/QuestionAnswerChat.tsx b/src/components/ContentGenerator/QuestionAnswerChat.tsx index f9c07b77d..a0d7addf1 100644 --- a/src/components/ContentGenerator/QuestionAnswerChat.tsx +++ b/src/components/ContentGenerator/QuestionAnswerChat.tsx @@ -7,6 +7,7 @@ import { import type { AllowedFormat } from './ContentGenerator'; import { Loader2Icon, + PartyPopper, RefreshCcwIcon, RotateCwIcon, SendIcon, @@ -56,6 +57,7 @@ export function QuestionAnswerChat(props: QuestionAnswerChatProps) { const [status, setStatus] = useState<'answering' | 'done'>('answering'); const scrollAreaRef = useRef(null); + const inputRef = useRef(null); const { data: aiQuestionSuggestions, @@ -108,6 +110,9 @@ export function QuestionAnswerChat(props: QuestionAnswerChatProps) { flushSync(() => { setActiveMessageIndex(activeMessageIndex + 1); setStatus('answering'); + + // focus the input + inputRef.current?.focus(); }); scrollToBottom(); @@ -226,6 +231,7 @@ export function QuestionAnswerChat(props: QuestionAnswerChatProps) {
setMessage(e.target.value)} className="w-full bg-transparent text-sm focus:outline-none" @@ -248,26 +254,27 @@ export function QuestionAnswerChat(props: QuestionAnswerChatProps) {
+ + {canGenerateNow && ( +
+

+ + Answer a few more questions for better output or{' '} + +

+
+ )} )} )} - - {canGenerateNow && status !== 'done' && activeMessage && ( -
-

- Keep answering for better output or{' '} - -

-
- )} ); } @@ -303,7 +310,7 @@ function QuestionAnswerChatMessage(props: QuestionAnswerChatMessageProps) {