mirror of https://github.com/buster-so/buster.git
Update useAutoChangeLayout.ts
This commit is contained in:
parent
bb908e7064
commit
5de03160c7
|
@ -26,7 +26,6 @@ export const useAutoChangeLayout = ({
|
||||||
selectedFileId: string | undefined;
|
selectedFileId: string | undefined;
|
||||||
chatId: string | undefined;
|
chatId: string | undefined;
|
||||||
}) => {
|
}) => {
|
||||||
const getChatMemoized = useGetChatMemoized();
|
|
||||||
const getChatMessageMemoized = useGetChatMessageMemoized();
|
const getChatMessageMemoized = useGetChatMessageMemoized();
|
||||||
const onSetSelectedFile = useChatLayoutContextSelector((x) => x.onSetSelectedFile);
|
const onSetSelectedFile = useChatLayoutContextSelector((x) => x.onSetSelectedFile);
|
||||||
const messageId = useChatLayoutContextSelector((x) => x.messageId);
|
const messageId = useChatLayoutContextSelector((x) => x.messageId);
|
||||||
|
@ -60,7 +59,9 @@ export const useAutoChangeLayout = ({
|
||||||
previousLastMessageId.current !== lastMessageId &&
|
previousLastMessageId.current !== lastMessageId &&
|
||||||
chatId
|
chatId
|
||||||
) {
|
) {
|
||||||
handle_isStreaming({ previousLastMessageId, onSetSelectedFile, lastMessageId });
|
console.log('trigger reasoning page!', previousLastMessageId.current, lastMessageId);
|
||||||
|
previousLastMessageId.current = lastMessageId;
|
||||||
|
onSetSelectedFile({ id: lastMessageId, type: 'reasoning', versionNumber: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
//this will when the chat is completed and it WAS streaming
|
//this will when the chat is completed and it WAS streaming
|
||||||
|
@ -126,16 +127,3 @@ export const useAutoChangeLayout = ({
|
||||||
}
|
}
|
||||||
}, [isCompletedStream, hasReasoning, lastMessageId]);
|
}, [isCompletedStream, hasReasoning, lastMessageId]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handle_isStreaming = ({
|
|
||||||
previousLastMessageId,
|
|
||||||
onSetSelectedFile,
|
|
||||||
lastMessageId
|
|
||||||
}: {
|
|
||||||
previousLastMessageId: MutableRefObject<string | null>;
|
|
||||||
onSetSelectedFile: (file: SelectedFile) => void;
|
|
||||||
lastMessageId: string;
|
|
||||||
}) => {
|
|
||||||
previousLastMessageId.current = lastMessageId;
|
|
||||||
onSetSelectedFile({ id: lastMessageId, type: 'reasoning', versionNumber: undefined });
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in New Issue