reasoning file click update

This commit is contained in:
Nate Kelley 2025-04-18 16:17:37 -06:00
parent 08d16d0897
commit 19199185d6
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
5 changed files with 5 additions and 32 deletions

View File

@ -36,10 +36,6 @@ export const MetricViewChartContent: React.FC<MetricViewChartContentProps> = Rea
return 'p-4'; return 'p-4';
}, [isTable, fetchedData]); }, [isTable, fetchedData]);
useMount(() => {
console.log('metricData');
});
return ( return (
<div className={cn('flex h-full flex-col overflow-hidden', cardClassName, className)}> <div className={cn('flex h-full flex-col overflow-hidden', cardClassName, className)}>
<BusterChart <BusterChart

View File

@ -24,21 +24,10 @@ export const ChatResponseMessage_File: React.FC<ChatResponseMessageProps> = Reac
}); });
const responseMessage = data as BusterChatResponseMessage_file; const responseMessage = data as BusterChatResponseMessage_file;
const { file_type, id } = responseMessage as BusterChatResponseMessage_file;
const { isSelectedFile } = useGetIsSelectedFile({ responseMessage }); const { isSelectedFile } = useGetIsSelectedFile({ responseMessage });
const onSetSelectedFile = useChatLayoutContextSelector((x) => x.onSetSelectedFile);
const href = useGetFileHref({ responseMessage, isSelectedFile, chatId }); const href = useGetFileHref({ responseMessage, isSelectedFile, chatId });
const onLinkClick = useMemoizedFn(() => {
if (isSelectedFile) {
return onSetSelectedFile(null);
}
onSetSelectedFile({ id, type: file_type, versionNumber: responseMessage.version_number });
});
useMount(() => { useMount(() => {
if (href) { if (href) {
router.prefetch(href); router.prefetch(href);
@ -46,7 +35,7 @@ export const ChatResponseMessage_File: React.FC<ChatResponseMessageProps> = Reac
}); });
return ( return (
<Link href={href} prefetch onClick={onLinkClick}> <Link href={href} prefetch>
<StreamingMessage_File <StreamingMessage_File
isCompletedStream={isCompletedStream} isCompletedStream={isCompletedStream}
responseMessage={responseMessage} responseMessage={responseMessage}

View File

@ -33,7 +33,6 @@ export const ChatResponseReasoning: React.FC<{
const { data: finalReasoningMessage } = useGetChatMessage(messageId, { const { data: finalReasoningMessage } = useGetChatMessage(messageId, {
select: (x) => x?.final_reasoning_message select: (x) => x?.final_reasoning_message
}); });
const onSetSelectedFile = useChatLayoutContextSelector((x) => x.onSetSelectedFile);
const selectedFileType = useChatLayoutContextSelector((x) => x.selectedFileType); const selectedFileType = useChatLayoutContextSelector((x) => x.selectedFileType);
const isReasonginFileSelected = selectedFileType === 'reasoning'; const isReasonginFileSelected = selectedFileType === 'reasoning';
const showShimmerText = isReasonginFileSelected ? false : !isCompletedStream; const showShimmerText = isReasonginFileSelected ? false : !isCompletedStream;
@ -50,14 +49,6 @@ export const ChatResponseReasoning: React.FC<{
return lastMessageTitle || 'Thinking...'; return lastMessageTitle || 'Thinking...';
}, [lastMessageTitle, finalReasoningMessage, blackBoxMessage]); }, [lastMessageTitle, finalReasoningMessage, blackBoxMessage]);
const onClickReasoningFile = useMemoizedFn(() => {
onSetSelectedFile(
isReasonginFileSelected
? null
: { id: messageId, type: 'reasoning', versionNumber: undefined }
);
});
const href = useMemo(() => { const href = useMemo(() => {
if (isReasonginFileSelected) { if (isReasonginFileSelected) {
return createBusterRoute({ return createBusterRoute({
@ -74,7 +65,7 @@ export const ChatResponseReasoning: React.FC<{
}, [isReasonginFileSelected, messageId, chatId]); }, [isReasonginFileSelected, messageId, chatId]);
return ( return (
<Link href={href} onClick={onClickReasoningFile}> <Link href={href}>
<AnimatePresence initial={!isCompletedStream} mode="wait"> <AnimatePresence initial={!isCompletedStream} mode="wait">
<motion.div <motion.div
{...animations} {...animations}

View File

@ -45,10 +45,6 @@ export const useAutoChangeLayout = ({
const hasReasoning = !!reasoningMessagesLength; const hasReasoning = !!reasoningMessagesLength;
useMount(() => {
console.log('MOUNTED?');
});
useEffect(() => { useEffect(() => {
console.log({ console.log({
isCompletedStream, isCompletedStream,

View File

@ -25,7 +25,8 @@ export const useLayoutConfig = ({
dashboardId, dashboardId,
currentRoute, currentRoute,
secondaryView, secondaryView,
appSplitterRef appSplitterRef,
messageId
}: { }: {
selectedFile: SelectedFile | null; selectedFile: SelectedFile | null;
chatId: string | undefined; chatId: string | undefined;
@ -189,7 +190,7 @@ export const useLayoutConfig = ({
fileView, fileView,
secondaryView: secondaryViewFromSelected secondaryView: secondaryViewFromSelected
}); });
}, [metricId, secondaryView, chatId, dashboardId, currentRoute]); }, [metricId, secondaryView, chatId, dashboardId, messageId, currentRoute]);
return { return {
selectedLayout, selectedLayout,