mirror of https://github.com/buster-so/buster.git
Update useAutoChangeLayout.ts
This commit is contained in:
parent
790f062494
commit
21a39aebf9
|
@ -12,17 +12,18 @@ export const useAutoChangeLayout = ({
|
|||
onSetSelectedFile: (file: SelectedFile) => void;
|
||||
}) => {
|
||||
const hasSeeningReasoningPage = useRef(false); //used when there is a delay in page load
|
||||
const message = useMessageIndividual(lastMessageId);
|
||||
const reasoningMessagesLength = message?.reasoning?.length;
|
||||
const isCompletedStream = message?.isCompletedStream;
|
||||
const isLoading = !isCompletedStream;
|
||||
const reasoningMessagesLength = useMessageIndividual(
|
||||
lastMessageId,
|
||||
(x) => x?.reasoning_message_ids?.length || 0
|
||||
);
|
||||
const isCompletedStream = useMessageIndividual(lastMessageId, (x) => x?.isCompletedStream);
|
||||
const hasReasoning = !!reasoningMessagesLength;
|
||||
|
||||
//change the page to reasoning file if we get a reasoning message
|
||||
useEffect(() => {
|
||||
if (isLoading && !hasSeeningReasoningPage.current && hasReasoning) {
|
||||
if (!isCompletedStream && !hasSeeningReasoningPage.current && hasReasoning) {
|
||||
hasSeeningReasoningPage.current = true;
|
||||
onSetSelectedFile({ id: lastMessageId, type: 'reasoning' });
|
||||
}
|
||||
}, [isLoading, hasReasoning]);
|
||||
}, [isCompletedStream, hasReasoning]);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue