mirror of https://github.com/buster-so/buster.git
fix logic for showing the bar
This commit is contained in:
parent
f7f74d9e83
commit
462c2b745e
|
@ -1,4 +1,4 @@
|
|||
import { useDebounceFn, useMemoizedFn } from '@/hooks';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { EditableTitle } from '@/components/ui/typography/EditableTitle';
|
||||
import React from 'react';
|
||||
import { useUpdateDashboard } from '@/api/buster_rest/dashboards';
|
||||
|
@ -50,7 +50,7 @@ export const DashboardEditTitles: React.FC<{
|
|||
className={'py-0! pl-0!'}
|
||||
readOnly={readOnly}
|
||||
onChange={onChangeDashboardDescription}
|
||||
defaultValue={description}
|
||||
value={description}
|
||||
autoResize={descriptionAutoResize}
|
||||
placeholder="Add description..."
|
||||
/>
|
||||
|
|
|
@ -9,6 +9,8 @@ import { ScrollArea } from '@/components/ui/scroll-area';
|
|||
import { useAutoScroll } from '@/hooks/useAutoScroll';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { ReasoningScrollToBottom } from './ReasoningScrollToBottom';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { queryKeys } from '@/api/query_keys';
|
||||
|
||||
interface ReasoningControllerProps {
|
||||
chatId: string;
|
||||
|
@ -23,6 +25,11 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
|
|||
const { data: isCompletedStream } = useGetChatMessage(messageId, {
|
||||
select: ({ isCompletedStream }) => isCompletedStream
|
||||
});
|
||||
const blackBoxMessage = useQuery({
|
||||
...queryKeys.chatsBlackBoxMessages(messageId),
|
||||
notifyOnChangeProps: ['data']
|
||||
}).data;
|
||||
|
||||
const viewportRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { isAutoScrollEnabled, scrollToBottom, enableAutoScroll } = useAutoScroll(viewportRef, {
|
||||
|
@ -49,11 +56,11 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
|
|||
isCompletedStream={isCompletedStream ?? true}
|
||||
chatId={chatId}
|
||||
messageId={messageId}
|
||||
isLastMessage={messageIndex === reasoningMessageIds.length - 1}
|
||||
isLastMessage={messageIndex === reasoningMessageIds.length - 1 && !blackBoxMessage}
|
||||
/>
|
||||
))}
|
||||
|
||||
<BlackBoxMessage messageId={messageId} />
|
||||
<BlackBoxMessage blackBoxMessage={blackBoxMessage} />
|
||||
</div>
|
||||
</ScrollArea>
|
||||
|
||||
|
|
|
@ -5,25 +5,22 @@ import React from 'react';
|
|||
import { queryKeys } from '@/api/query_keys';
|
||||
import { BarContainer } from './BarContainer';
|
||||
|
||||
export const BlackBoxMessage: React.FC<{ messageId: string }> = React.memo(({ messageId }) => {
|
||||
const blackBoxMessage = useQuery({
|
||||
...queryKeys.chatsBlackBoxMessages(messageId),
|
||||
notifyOnChangeProps: ['data']
|
||||
}).data;
|
||||
export const BlackBoxMessage: React.FC<{ blackBoxMessage: string | undefined | null }> = React.memo(
|
||||
({ blackBoxMessage }) => {
|
||||
if (blackBoxMessage) {
|
||||
return (
|
||||
<BarContainer
|
||||
showBar={false}
|
||||
status={'loading'}
|
||||
isCompletedStream={false}
|
||||
title={blackBoxMessage}
|
||||
secondaryTitle={''}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (blackBoxMessage) {
|
||||
return (
|
||||
<BarContainer
|
||||
showBar={false}
|
||||
status={'loading'}
|
||||
isCompletedStream={false}
|
||||
title={blackBoxMessage}
|
||||
secondaryTitle={''}
|
||||
/>
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
);
|
||||
|
||||
BlackBoxMessage.displayName = 'BlackBoxMessage';
|
||||
|
|
Loading…
Reference in New Issue