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 { 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..."
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,22 @@ 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),
|
if (blackBoxMessage) {
|
||||||
notifyOnChangeProps: ['data']
|
return (
|
||||||
}).data;
|
<BarContainer
|
||||||
|
showBar={false}
|
||||||
|
status={'loading'}
|
||||||
|
isCompletedStream={false}
|
||||||
|
title={blackBoxMessage}
|
||||||
|
secondaryTitle={''}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (blackBoxMessage) {
|
return null;
|
||||||
return (
|
|
||||||
<BarContainer
|
|
||||||
showBar={false}
|
|
||||||
status={'loading'}
|
|
||||||
isCompletedStream={false}
|
|
||||||
title={blackBoxMessage}
|
|
||||||
secondaryTitle={''}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
BlackBoxMessage.displayName = 'BlackBoxMessage';
|
BlackBoxMessage.displayName = 'BlackBoxMessage';
|
||||||
|
|
Loading…
Reference in New Issue