From 67fd244e66e03cacfffe02d81df299e9783c69b5 Mon Sep 17 00:00:00 2001 From: Weves Date: Sun, 13 Aug 2023 16:05:59 -0700 Subject: [PATCH] Make docs show up immediately rather than wait until first answer token --- .../search/SearchResultsDisplay.tsx | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/web/src/components/search/SearchResultsDisplay.tsx b/web/src/components/search/SearchResultsDisplay.tsx index 235722b8c..30a1ec5f3 100644 --- a/web/src/components/search/SearchResultsDisplay.tsx +++ b/web/src/components/search/SearchResultsDisplay.tsx @@ -42,7 +42,7 @@ export const SearchResultsDisplay: React.FC = ({ const { answer, quotes, documents, error } = searchResponse; - if (isFetching && !answer) { + if (isFetching && !answer && !documents) { return (
@@ -71,17 +71,36 @@ export const SearchResultsDisplay: React.FC = ({ searchResponse.suggestedFlowType === FlowType.QUESTION_ANSWER || defaultOverrides.forceDisplayQA; + let answerDisplay = ; + if (error) { + answerDisplay = ( +
+ +
{error}
+
+ ); + } else if (answer) { + answerDisplay =

{answer}

; + } else if (!isFetching) { + answerDisplay = ( +
Information not found
+ ); + } + return ( <> - {answer && shouldDisplayQA && ( + {shouldDisplayQA && (

AI Answer

-

{answer}

+ {answerDisplay} - {quotes !== null && ( + {quotes !== null && answer && ( <>

Sources

{isFetching && dedupedQuotes.length === 0 ? ( @@ -124,20 +143,6 @@ export const SearchResultsDisplay: React.FC = ({
)} - {(answer === null || answer === undefined) && - !isFetching && - shouldDisplayQA && ( -
- -
- {error ?? "GPT hurt itself in its confusion :("} -
-
- )} - {documents && documents.length > 0 && (