mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-25 11:16:43 +02:00
Very minor robustification (#3926)
* very minor robustification * robust
This commit is contained in:
@@ -218,6 +218,7 @@ export interface SubQuestionDetail extends BaseQuestionIdentifier {
|
||||
sub_queries?: SubQueryDetail[] | null;
|
||||
context_docs?: { top_documents: OnyxDocument[] } | null;
|
||||
is_complete?: boolean;
|
||||
is_stopped?: boolean;
|
||||
}
|
||||
|
||||
export interface SubQueryDetail {
|
||||
@@ -255,6 +256,7 @@ export const constructSubQuestions = (
|
||||
);
|
||||
if (subQuestion) {
|
||||
subQuestion.is_complete = true;
|
||||
subQuestion.is_stopped = true;
|
||||
}
|
||||
} else if ("top_documents" in newDetail) {
|
||||
const { level, level_question_num, top_documents } = newDetail;
|
||||
|
@@ -134,7 +134,7 @@ export const useStreamingMessages = (
|
||||
if (nextIndex <= sq.question.length) {
|
||||
dynSQ.question = sq.question.slice(0, nextIndex);
|
||||
p.questionCharIndex = nextIndex;
|
||||
if (nextIndex >= sq.question.length) {
|
||||
if (nextIndex >= sq.question.length && sq.is_stopped) {
|
||||
p.questionDone = true;
|
||||
}
|
||||
didStreamQuestion = true;
|
||||
|
@@ -481,9 +481,7 @@ const SubQuestionsDisplay: React.FC<SubQuestionsDisplayProps> = ({
|
||||
subQuestions,
|
||||
() => {},
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
setShowSummarizing(true);
|
||||
}, PHASE_MIN_MS * 3);
|
||||
setShowSummarizing(true);
|
||||
}
|
||||
);
|
||||
const { dynamicSubQuestions: dynamicSecondLevelQuestions } =
|
||||
@@ -549,20 +547,6 @@ const SubQuestionsDisplay: React.FC<SubQuestionsDisplayProps> = ({
|
||||
}
|
||||
}, [memoizedSubQuestions]);
|
||||
|
||||
useEffect(() => {
|
||||
const allSubQuestionsAnswered =
|
||||
memoizedSubQuestions.length > 0 &&
|
||||
memoizedSubQuestions.every(
|
||||
(subQuestion) => subQuestion?.question.length > 5
|
||||
);
|
||||
|
||||
if (allSubQuestionsAnswered) {
|
||||
setTimeout(() => {
|
||||
setShowSummarizing(true);
|
||||
}, PHASE_MIN_MS * 0.75);
|
||||
}
|
||||
}, [memoizedSubQuestions, finishedGenerating]);
|
||||
|
||||
useEffect(() => {
|
||||
if (showSummarizing && streamedText !== "Summarize findings") {
|
||||
const fullText = "Summarize findings";
|
||||
|
Reference in New Issue
Block a user