mirror of https://github.com/buster-so/buster.git
update some black box testing stuff
This commit is contained in:
parent
de542b47e7
commit
7423fe31a3
|
@ -175,10 +175,6 @@ const ResizeRowHandle: React.FC<{
|
|||
/>
|
||||
<div
|
||||
className={cn(
|
||||
// 'pointer-events-none absolute right-0 left-0 z-50 h-[54px] bg-red-200 opacity-20',
|
||||
// top ? '-top-[36px]' : '-bottom-[15px]',
|
||||
// showActive && 'opacity-80',
|
||||
// styles.hitArea
|
||||
'pointer-events-all absolute right-0 left-0 z-50 h-[54px] opacity-0',
|
||||
top ? '-top-[36px]' : '-bottom-[15px]'
|
||||
)}
|
||||
|
|
|
@ -520,4 +520,36 @@ describe('updateReasoningMessage', () => {
|
|||
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?');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) || '';
|
||||
|
|
|
@ -10,7 +10,6 @@ export const FileContainer: React.FC<FileContainerProps> = ({ children }) => {
|
|||
return (
|
||||
<AppPageLayout className="flex h-full min-w-[325px] flex-col" header={<FileContainerHeader />}>
|
||||
{children}
|
||||
<span className="text-blue-500">SWAG</span>
|
||||
</AppPageLayout>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue