mirror of https://github.com/buster-so/buster.git
update some logging
This commit is contained in:
parent
2800e4a389
commit
88a467168d
|
@ -1,6 +1,7 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
import { StreamingMessage_File } from './StreamingMessage_File';
|
import { StreamingMessage_File } from './StreamingMessage_File';
|
||||||
import type { BusterChatResponseMessage_file } from '@/api/asset_interfaces';
|
import type { BusterChatResponseMessage_file } from '@/api/asset_interfaces';
|
||||||
|
import { fn } from '@storybook/test';
|
||||||
|
|
||||||
const meta: Meta<typeof StreamingMessage_File> = {
|
const meta: Meta<typeof StreamingMessage_File> = {
|
||||||
title: 'UI/Streaming/StreamingMessage_File',
|
title: 'UI/Streaming/StreamingMessage_File',
|
||||||
|
@ -48,7 +49,7 @@ export const Default: Story = {
|
||||||
isSelectedFile: false,
|
isSelectedFile: false,
|
||||||
isCompletedStream: true,
|
isCompletedStream: true,
|
||||||
responseMessage: mockResponseMessage,
|
responseMessage: mockResponseMessage,
|
||||||
onClick: () => console.log('File clicked')
|
onClick: fn()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ export const Selected: Story = {
|
||||||
isSelectedFile: true,
|
isSelectedFile: true,
|
||||||
isCompletedStream: true,
|
isCompletedStream: true,
|
||||||
responseMessage: mockResponseMessage,
|
responseMessage: mockResponseMessage,
|
||||||
onClick: () => console.log('File clicked')
|
onClick: fn()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ export const Streaming: Story = {
|
||||||
isSelectedFile: false,
|
isSelectedFile: false,
|
||||||
isCompletedStream: false,
|
isCompletedStream: false,
|
||||||
responseMessage: mockResponseMessage,
|
responseMessage: mockResponseMessage,
|
||||||
onClick: () => console.log('File clicked')
|
onClick: fn()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,6 +79,6 @@ export const LongFileName: Story = {
|
||||||
...mockResponseMessage,
|
...mockResponseMessage,
|
||||||
file_name: 'very_long_file_name_that_should_truncate_in_the_ui.txt'
|
file_name: 'very_long_file_name_that_should_truncate_in_the_ui.txt'
|
||||||
},
|
},
|
||||||
onClick: () => console.log('File clicked')
|
onClick: fn()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,8 +37,8 @@ export const useChatStreamMessage = () => {
|
||||||
(iChatMessage: Parameters<typeof onUpdateChatMessage>[0]) => {
|
(iChatMessage: Parameters<typeof onUpdateChatMessage>[0]) => {
|
||||||
onUpdateChatMessage(iChatMessage);
|
onUpdateChatMessage(iChatMessage);
|
||||||
console.log(
|
console.log(
|
||||||
iChatMessage.reasoning_message_ids,
|
iChatMessage.reasoning_message_ids?.length,
|
||||||
Object.keys(iChatMessage.reasoning_messages || {})
|
Object.keys(iChatMessage.reasoning_messages || {}).length
|
||||||
);
|
);
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
//
|
//
|
||||||
|
@ -191,6 +191,9 @@ export const useChatStreamMessage = () => {
|
||||||
const _generatingReasoningMessageCallback = useMemoizedFn(
|
const _generatingReasoningMessageCallback = useMemoizedFn(
|
||||||
(_: null, d: ChatEvent_GeneratingReasoningMessage) => {
|
(_: null, d: ChatEvent_GeneratingReasoningMessage) => {
|
||||||
const { message_id, reasoning, chat_id } = d;
|
const { message_id, reasoning, chat_id } = d;
|
||||||
|
if (!reasoning?.id) {
|
||||||
|
console.log(d);
|
||||||
|
}
|
||||||
const reasoningMessageId = reasoning.id;
|
const reasoningMessageId = reasoning.id;
|
||||||
const existingMessage =
|
const existingMessage =
|
||||||
chatRef.current[chat_id]?.messages?.[message_id]?.reasoning_messages?.[reasoningMessageId];
|
chatRef.current[chat_id]?.messages?.[message_id]?.reasoning_messages?.[reasoningMessageId];
|
||||||
|
|
|
@ -4,6 +4,7 @@ import React from 'react';
|
||||||
import { useChatIndividualContextSelector } from '@chatLayout/ChatContext';
|
import { useChatIndividualContextSelector } from '@chatLayout/ChatContext';
|
||||||
import { ReasoningMessageContainer } from './ReasoningMessageContainer';
|
import { ReasoningMessageContainer } from './ReasoningMessageContainer';
|
||||||
import { useMessageIndividual } from '@/context/Chats';
|
import { useMessageIndividual } from '@/context/Chats';
|
||||||
|
import { useWhyDidYouUpdate } from 'ahooks';
|
||||||
|
|
||||||
interface ReasoningControllerProps {
|
interface ReasoningControllerProps {
|
||||||
chatId: string;
|
chatId: string;
|
||||||
|
@ -15,7 +16,13 @@ export const ReasoningController: React.FC<ReasoningControllerProps> = ({ chatId
|
||||||
const reasoningMessageIds = useMessageIndividual(messageId, (x) => x?.reasoning_message_ids);
|
const reasoningMessageIds = useMessageIndividual(messageId, (x) => x?.reasoning_message_ids);
|
||||||
const isCompletedStream = useMessageIndividual(messageId, (x) => x?.isCompletedStream);
|
const isCompletedStream = useMessageIndividual(messageId, (x) => x?.isCompletedStream);
|
||||||
|
|
||||||
console.log('here!', hasChat, reasoningMessageIds);
|
useWhyDidYouUpdate('ReasoningController', {
|
||||||
|
hasChat,
|
||||||
|
reasoningMessageIds,
|
||||||
|
isCompletedStream,
|
||||||
|
chatId,
|
||||||
|
messageId
|
||||||
|
});
|
||||||
|
|
||||||
if (!hasChat || !reasoningMessageIds) return <></>;
|
if (!hasChat || !reasoningMessageIds) return <></>;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ const createMockReasoningFile = (
|
||||||
version_id: 'v1',
|
version_id: 'v1',
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
file: {
|
file: {
|
||||||
text: 'console.log("Hello World") \nconsole.log("Hello World") \nconsole.log("Hello World") \n',
|
text: 'console.test("Hello World") \nconsole.test("Hello World") \nconsole.test("Hello World") \n',
|
||||||
modified: [[1, 1]]
|
modified: [[1, 1]]
|
||||||
},
|
},
|
||||||
...overrides
|
...overrides
|
||||||
|
@ -48,7 +48,7 @@ export const Default: Story = {
|
||||||
export const Loading: Story = {
|
export const Loading: Story = {
|
||||||
render: () => {
|
render: () => {
|
||||||
const [text, setText] = React.useState(
|
const [text, setText] = React.useState(
|
||||||
'function example() {\n console.log("Hello, world!");\n'
|
'function example() {\n console.test("Hello, world!");\n'
|
||||||
);
|
);
|
||||||
|
|
||||||
const addLine = () => {
|
const addLine = () => {
|
||||||
|
|
|
@ -130,8 +130,6 @@ export const ReasoningMessage_File: React.FC<ReasoningMessageFileProps> = React.
|
||||||
processText();
|
processText();
|
||||||
}, [text, modified]);
|
}, [text, modified]);
|
||||||
|
|
||||||
console.log(lineSegments);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppCodeBlockWrapper
|
<AppCodeBlockWrapper
|
||||||
title={<ReasoningFileTitle file_name={file_name} version_number={version_number} />}
|
title={<ReasoningFileTitle file_name={file_name} version_number={version_number} />}
|
||||||
|
|
|
@ -9,7 +9,6 @@ export const ReasoningMessage_Text: React.FC<ReasoningMessageProps> = React.memo
|
||||||
const { message, status, id, type, title, secondary_title } =
|
const { message, status, id, type, title, secondary_title } =
|
||||||
reasoningMessage as BusterChatMessageReasoning_text;
|
reasoningMessage as BusterChatMessageReasoning_text;
|
||||||
|
|
||||||
console.log('here', message?.length);
|
|
||||||
return (
|
return (
|
||||||
<BarContainer
|
<BarContainer
|
||||||
showBar={true}
|
showBar={true}
|
||||||
|
|
Loading…
Reference in New Issue