mirror of https://github.com/buster-so/buster.git
remove
This commit is contained in:
parent
af59f29944
commit
b53ba83849
|
@ -142,7 +142,6 @@ export const StreamingMessageCode: React.FC<
|
|||
)}
|
||||
</motion.div>
|
||||
))}
|
||||
{showLoader && <TextDotLoader className="pl-2" />}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
</AppCodeBlockWrapper>
|
||||
|
|
|
@ -66,6 +66,7 @@ export const useChatStreamMessage = () => {
|
|||
const completeChatCallback = useMemoizedFn((d: BusterChat) => {
|
||||
const { iChat, iChatMessages } = updateChatToIChat(d, false);
|
||||
chatRef.current[iChat.id] = iChat;
|
||||
console.log(iChatMessages);
|
||||
normalizeChatMessage(iChatMessages);
|
||||
onUpdateChat(iChat);
|
||||
removeBlackBoxMessage({ messageId: iChat.message_ids[iChat.message_ids.length - 1] });
|
||||
|
|
|
@ -24,6 +24,19 @@ const meta: Meta<typeof ReasoningMessageSelector> = {
|
|||
queryClient.setQueryData(['chats', 'messages', 'message-1'], mockBusterChatMessage);
|
||||
queryClient.setQueryData(['chats', 'messages', 'message-2'], mockBusterChatMessage);
|
||||
queryClient.setQueryData(['chats', 'messages', 'message-3'], mockBusterChatMessage);
|
||||
queryClient.setQueryData(['chats', 'messages', 'empty-message'], {
|
||||
...mockBusterChatMessage,
|
||||
reasoning_messages: {
|
||||
'reasoning-1': {
|
||||
id: 'reasoning-1',
|
||||
type: 'text',
|
||||
title: 'Text Reasoning',
|
||||
secondary_title: 'Additional Context',
|
||||
message: '',
|
||||
status: 'completed'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
|
@ -58,6 +71,15 @@ export const TextReasoning: Story = {
|
|||
}
|
||||
};
|
||||
|
||||
export const TextEmptyReasoning: Story = {
|
||||
args: {
|
||||
reasoningMessageId: 'reasoning-1',
|
||||
messageId: 'empty-message',
|
||||
isCompletedStream: false,
|
||||
chatId: 'chat-1'
|
||||
}
|
||||
};
|
||||
|
||||
export const PillsReasoning: Story = {
|
||||
args: {
|
||||
reasoningMessageId: 'reasoning-2',
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import React from 'react';
|
||||
import type { BusterChatMessageReasoning } from '@/api/asset_interfaces';
|
||||
import React, { useMemo } from 'react';
|
||||
import type {
|
||||
BusterChatMessageReasoning,
|
||||
BusterChatMessageReasoning_text
|
||||
} from '@/api/asset_interfaces/chat';
|
||||
import { ReasoningMessage_PillsContainer } from './ReasoningMessage_PillContainers';
|
||||
import { ReasoningMessage_Files } from './ReasoningMessage_Files';
|
||||
import { ReasoningMessage_Text } from './ReasoningMessage_Text';
|
||||
|
@ -64,12 +67,23 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
|||
chatId,
|
||||
messageId
|
||||
}) => {
|
||||
const { title, type, secondary_title, status } = useMessageIndividual(messageId, (x) => ({
|
||||
title: x?.reasoning_messages[reasoningMessageId]?.title,
|
||||
secondary_title: x?.reasoning_messages[reasoningMessageId]?.secondary_title,
|
||||
type: x?.reasoning_messages[reasoningMessageId]?.type,
|
||||
status: x?.reasoning_messages[reasoningMessageId]?.status
|
||||
}));
|
||||
const { title, hasMessage, type, secondary_title, status } = useMessageIndividual(
|
||||
messageId,
|
||||
(x) => ({
|
||||
title: x?.reasoning_messages[reasoningMessageId]?.title,
|
||||
secondary_title: x?.reasoning_messages[reasoningMessageId]?.secondary_title,
|
||||
type: x?.reasoning_messages[reasoningMessageId]?.type,
|
||||
status: x?.reasoning_messages[reasoningMessageId]?.status,
|
||||
hasMessage:
|
||||
(x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_text)?.message !==
|
||||
''
|
||||
})
|
||||
);
|
||||
|
||||
const showBar = useMemo(() => {
|
||||
if (type === 'text') return hasMessage;
|
||||
return true;
|
||||
}, [type, hasMessage]);
|
||||
|
||||
if (!type || !status) return null;
|
||||
|
||||
|
@ -78,7 +92,7 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
|||
|
||||
return (
|
||||
<BarContainer
|
||||
showBar={true}
|
||||
showBar={showBar}
|
||||
status={status}
|
||||
isCompletedStream={isCompletedStream}
|
||||
title={title ?? ''}
|
||||
|
@ -96,3 +110,12 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
|||
</BarContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const showBarHelper = (
|
||||
type: BusterChatMessageReasoning['type'],
|
||||
status: BusterChatMessageReasoning['status']
|
||||
) => {
|
||||
if (type === 'pills') return false;
|
||||
if (status === 'loading') return false;
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,8 @@ const chatMessageUpgrader = (
|
|||
return messageIds.reduce(
|
||||
(acc, messageId) => {
|
||||
acc[messageId] = create(message[messageId] as IBusterChatMessage, (draft) => {
|
||||
draft.isCompletedStream = streamingMessageId === messageId;
|
||||
draft.isCompletedStream = streamingMessageId !== messageId;
|
||||
return draft;
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue