diff --git a/web/src/components/ui/grid/BusterResizeRows.tsx b/web/src/components/ui/grid/BusterResizeRows.tsx index 747210daf..cc465fdcd 100644 --- a/web/src/components/ui/grid/BusterResizeRows.tsx +++ b/web/src/components/ui/grid/BusterResizeRows.tsx @@ -175,10 +175,6 @@ const ResizeRowHandle: React.FC<{ />
{ expect(updatedFiles.files['file-1'].file?.text).toBe('Initial content additional content'); expect(updatedFiles.files['file-2'].file?.text).toBe('New file content'); }); + + it('should handle multiple updates and append text to existing reasoning message', () => { + const reasoning: BusterChatMessageReasoning_text = { + id: 'reasoning-1', + type: 'text', + message: '', + message_chunk: 'Hello', + title: 'Test Title', + secondary_title: 'Test Secondary Title', + status: 'loading' + }; + + // First update with "Hello" + let result = updateReasoningMessage('test-message-id', undefined, reasoning); + expect( + (result.reasoning_messages['reasoning-1'] as BusterChatMessageReasoning_text).message + ).toBe('Hello'); + + // Second update with ", how" + reasoning.message_chunk = ', how'; + result = updateReasoningMessage('test-message-id', result, reasoning); + expect( + (result.reasoning_messages['reasoning-1'] as BusterChatMessageReasoning_text).message + ).toBe('Hello, how'); + + // Third update with " are you doing today?" + reasoning.message_chunk = ' are you doing today?'; + result = updateReasoningMessage('test-message-id', result, reasoning); + expect( + (result.reasoning_messages['reasoning-1'] as BusterChatMessageReasoning_text).message + ).toBe('Hello, how are you doing today?'); + }); }); diff --git a/web/src/context/Chats/NewChatProvider/useBlackBoxMessage.ts b/web/src/context/Chats/NewChatProvider/useBlackBoxMessage.ts index c9cab8c75..4998401a6 100644 --- a/web/src/context/Chats/NewChatProvider/useBlackBoxMessage.ts +++ b/web/src/context/Chats/NewChatProvider/useBlackBoxMessage.ts @@ -17,6 +17,7 @@ export const useBlackBoxMessage = () => { const queryClient = useQueryClient(); const removeAutoThought = useMemoizedFn(({ messageId }: { messageId: string }) => { + console.log('removeAutoThought', messageId); if (timeoutRef.current[messageId]) { clearTimeout(timeoutRef.current[messageId]); delete timeoutRef.current[messageId]; @@ -28,13 +29,14 @@ export const useBlackBoxMessage = () => { const addAutoThought = useMemoizedFn(({ messageId }: { messageId: string }) => { const randomThought = getRandomThought(); + console.log(messageId, randomThought); const options = queryKeys.chatsBlackBoxMessages(messageId); queryClient.setQueryData(options.queryKey, randomThought); }); const checkAutoThought = useMemoizedFn( (message: IBusterChatMessage, event: ChatEvent_GeneratingReasoningMessage) => { - const isFinishedReasoningMessage = event.progress === 'completed'; + const isFinishedReasoningMessage = event.reasoning.status !== 'loading'; if (isFinishedReasoningMessage) { addAutoThought({ messageId: message.id }); _loopAutoThought({ messageId: message.id }); @@ -48,6 +50,7 @@ export const useBlackBoxMessage = () => { const randomDelay = random(3000, 5000); timeoutRef.current[messageId] = setTimeout(() => { const message = getChatMessageMemoized(messageId); + console.log('loopAutoThought', messageId, !!message); if (!message) return; const isMessageCompletedStream = !!message?.isCompletedStream; const lastReasoningMessageId = last(message?.reasoning_message_ids) || ''; diff --git a/web/src/layouts/ChatLayout/FileContainer/FileContainer.tsx b/web/src/layouts/ChatLayout/FileContainer/FileContainer.tsx index 293287e8c..255de07cd 100644 --- a/web/src/layouts/ChatLayout/FileContainer/FileContainer.tsx +++ b/web/src/layouts/ChatLayout/FileContainer/FileContainer.tsx @@ -10,7 +10,6 @@ export const FileContainer: React.FC = ({ children }) => { return ( }> {children} - SWAG ); }; diff --git a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts index 272e4ee5a..0585f6167 100644 --- a/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts +++ b/web/src/layouts/ChatLayout/hooks/useSelectedFileAndLayout/useSelectedFileAndLayout.ts @@ -50,7 +50,9 @@ export const useSelectedFileAndLayout = ({ setRenderViewLayoutKey('both'); setSelectedFile(file); + console.log('page', route); await onChangePage(route); + console.log('page done'); startTransition(() => { animateOpenSplitter('both');