fix logic for showing the bar

This commit is contained in:
Nate Kelley 2025-04-21 15:14:08 -06:00
parent f7f74d9e83
commit 462c2b745e
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 26 additions and 22 deletions

View File

@ -1,4 +1,4 @@
import { useDebounceFn, useMemoizedFn } from '@/hooks'; import { useMemoizedFn } from '@/hooks';
import { EditableTitle } from '@/components/ui/typography/EditableTitle'; import { EditableTitle } from '@/components/ui/typography/EditableTitle';
import React from 'react'; import React from 'react';
import { useUpdateDashboard } from '@/api/buster_rest/dashboards'; import { useUpdateDashboard } from '@/api/buster_rest/dashboards';
@ -50,7 +50,7 @@ export const DashboardEditTitles: React.FC<{
className={'py-0! pl-0!'} className={'py-0! pl-0!'}
readOnly={readOnly} readOnly={readOnly}
onChange={onChangeDashboardDescription} onChange={onChangeDashboardDescription}
defaultValue={description} value={description}
autoResize={descriptionAutoResize} autoResize={descriptionAutoResize}
placeholder="Add description..." placeholder="Add description..."
/> />

View File

@ -9,6 +9,8 @@ import { ScrollArea } from '@/components/ui/scroll-area';
import { useAutoScroll } from '@/hooks/useAutoScroll'; import { useAutoScroll } from '@/hooks/useAutoScroll';
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import { ReasoningScrollToBottom } from './ReasoningScrollToBottom'; import { ReasoningScrollToBottom } from './ReasoningScrollToBottom';
import { useQuery } from '@tanstack/react-query';
import { queryKeys } from '@/api/query_keys';
interface ReasoningControllerProps { interface ReasoningControllerProps {
chatId: string; chatId: string;
@ -23,6 +25,11 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
const { data: isCompletedStream } = useGetChatMessage(messageId, { const { data: isCompletedStream } = useGetChatMessage(messageId, {
select: ({ isCompletedStream }) => isCompletedStream select: ({ isCompletedStream }) => isCompletedStream
}); });
const blackBoxMessage = useQuery({
...queryKeys.chatsBlackBoxMessages(messageId),
notifyOnChangeProps: ['data']
}).data;
const viewportRef = useRef<HTMLDivElement>(null); const viewportRef = useRef<HTMLDivElement>(null);
const { isAutoScrollEnabled, scrollToBottom, enableAutoScroll } = useAutoScroll(viewportRef, { const { isAutoScrollEnabled, scrollToBottom, enableAutoScroll } = useAutoScroll(viewportRef, {
@ -49,11 +56,11 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
isCompletedStream={isCompletedStream ?? true} isCompletedStream={isCompletedStream ?? true}
chatId={chatId} chatId={chatId}
messageId={messageId} messageId={messageId}
isLastMessage={messageIndex === reasoningMessageIds.length - 1} isLastMessage={messageIndex === reasoningMessageIds.length - 1 && !blackBoxMessage}
/> />
))} ))}
<BlackBoxMessage messageId={messageId} /> <BlackBoxMessage blackBoxMessage={blackBoxMessage} />
</div> </div>
</ScrollArea> </ScrollArea>

View File

@ -5,12 +5,8 @@ import React from 'react';
import { queryKeys } from '@/api/query_keys'; import { queryKeys } from '@/api/query_keys';
import { BarContainer } from './BarContainer'; import { BarContainer } from './BarContainer';
export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ messageId }) => { export const BlackBoxMessage: React.FC<{ blackBoxMessage: string | undefined | null }> = React.memo(
const blackBoxMessage = useQuery({ ({ blackBoxMessage }) => {
...queryKeys.chatsBlackBoxMessages(messageId),
notifyOnChangeProps: ['data']
}).data;
if (blackBoxMessage) { if (blackBoxMessage) {
return ( return (
<BarContainer <BarContainer
@ -24,6 +20,7 @@ export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ me
} }
return null; return null;
}); }
);
BlackBoxMessage.displayName = 'BlackBoxMessage'; BlackBoxMessage.displayName = 'BlackBoxMessage';