Update useAutoChangeLayout.ts

This commit is contained in:
Nate Kelley 2025-04-16 09:14:05 -06:00
parent bb908e7064
commit 5de03160c7
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 3 additions and 15 deletions

View File

@ -26,7 +26,6 @@ export const useAutoChangeLayout = ({
selectedFileId: string | undefined;
chatId: string | undefined;
}) => {
const getChatMemoized = useGetChatMemoized();
const getChatMessageMemoized = useGetChatMessageMemoized();
const onSetSelectedFile = useChatLayoutContextSelector((x) => x.onSetSelectedFile);
const messageId = useChatLayoutContextSelector((x) => x.messageId);
@ -60,7 +59,9 @@ export const useAutoChangeLayout = ({
previousLastMessageId.current !== lastMessageId &&
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
@ -126,16 +127,3 @@ export const useAutoChangeLayout = ({
}
}, [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 });
};