diff --git a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx b/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx
index 3f8e98f88..fa7b72adb 100644
--- a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx
+++ b/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx
@@ -142,7 +142,6 @@ export const StreamingMessageCode: React.FC<
)}
))}
- {showLoader && }
diff --git a/web/src/context/Chats/NewChatProvider/useChatStreamMessage.ts b/web/src/context/Chats/NewChatProvider/useChatStreamMessage.ts
index e4b8687e4..6d9a95893 100644
--- a/web/src/context/Chats/NewChatProvider/useChatStreamMessage.ts
+++ b/web/src/context/Chats/NewChatProvider/useChatStreamMessage.ts
@@ -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] });
diff --git a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx
index 1b558dabe..f18fd7bbd 100644
--- a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx
+++ b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.stories.tsx
@@ -24,6 +24,19 @@ const meta: Meta = {
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 (
@@ -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',
diff --git a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.tsx b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.tsx
index 065d83f1a..dd6f04b56 100644
--- a/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.tsx
+++ b/web/src/controllers/ReasoningController/ReasoningMessages/ReasoningMessageSelector.tsx
@@ -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 =
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 =
return (
=
);
};
+
+const showBarHelper = (
+ type: BusterChatMessageReasoning['type'],
+ status: BusterChatMessageReasoning['status']
+) => {
+ if (type === 'pills') return false;
+ if (status === 'loading') return false;
+ return true;
+};
diff --git a/web/src/lib/chat.ts b/web/src/lib/chat.ts
index 5c7568e94..b44f9b9f8 100644
--- a/web/src/lib/chat.ts
+++ b/web/src/lib/chat.ts
@@ -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;
},