diff --git a/frontend/src/Hero.tsx b/frontend/src/Hero.tsx index f35eaa6f8..904dd2795 100644 --- a/frontend/src/Hero.tsx +++ b/frontend/src/Hero.tsx @@ -4,7 +4,13 @@ import { useTranslation } from 'react-i18next'; export default function Hero({ handleQuestion, }: { - handleQuestion: (question: string) => void; + handleQuestion: ({ + question, + isRetry, + }: { + question: string; + isRetry?: boolean; + }) => void; }) { const { t } = useTranslation(); const demos = t('demo', { returnObjects: true }) as Array<{ @@ -30,7 +36,7 @@ export default function Hero({ demo.query && ( + ); + responseView = ( + + ); } return responseView; }; @@ -165,15 +223,18 @@ export default function Conversation() { type="QUESTION" sources={query.sources} > + {prepResponseView(query, index)} ); })} )} + {queries.length === 0 && } -
+ +
{ if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); - if (inputRef.current?.textContent && status !== 'loading') { - handleQuestion(inputRef.current.textContent); - inputRef.current.textContent = ''; - } + handleQuestionSubmission(); } }} >
@@ -202,18 +260,14 @@ export default function Conversation() {
{ - if (inputRef.current?.textContent) { - handleQuestion(inputRef.current.textContent); - inputRef.current.textContent = ''; - } - }} + onClick={handleQuestionSubmission} src={isDarkTheme ? SendDark : Send} >
)}
-

+ +

{t('tagline')}

diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index aa9c4e3dc..3a3842b2a 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -23,9 +23,10 @@ const ConversationBubble = forwardRef< feedback?: FEEDBACK; handleFeedback?: (feedback: FEEDBACK) => void; sources?: { title: string; text: string; source: string }[]; + retryBtn?: React.ReactElement; } >(function ConversationBubble( - { message, type, className, feedback, handleFeedback, sources }, + { message, type, className, feedback, handleFeedback, sources, retryBtn }, ref, ) { const [openSource, setOpenSource] = useState(null); @@ -69,12 +70,17 @@ const ConversationBubble = forwardRef<
{type === 'ERROR' && ( - alert + <> + alert +
+ {retryBtn} +
+ )}