mirror of https://github.com/buster-so/buster.git
fixed broken data getter 🥰
This commit is contained in:
parent
d20d6bf333
commit
b33ebf675a
|
@ -156,5 +156,5 @@ export const useGetChatMessage = <TData = IBusterChatMessage>(
|
|||
enabled: false, //this will come from the chat
|
||||
select: selector
|
||||
});
|
||||
return data || ({} as TData);
|
||||
return data;
|
||||
};
|
||||
|
|
|
@ -67,20 +67,18 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
|||
chatId,
|
||||
messageId
|
||||
}) => {
|
||||
const { title, type, secondary_title, status, hasMessage } = useGetChatMessage(
|
||||
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 messageStuff = useGetChatMessage(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 { title, secondary_title, type, status, hasMessage } = messageStuff || {};
|
||||
|
||||
const showBar = useMemo(() => {
|
||||
if (type === 'text') return hasMessage;
|
||||
if (type === 'text') return !!hasMessage;
|
||||
return true;
|
||||
}, [type, hasMessage]);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export const ChatResponseMessageSelector: React.FC<ChatResponseMessageSelectorPr
|
|||
const messageType = useGetChatMessage(
|
||||
messageId,
|
||||
(x) => x?.response_messages?.[responseMessageId]?.type || 'text'
|
||||
);
|
||||
)!;
|
||||
const ChatResponseMessage = ChatResponseMessageRecord[messageType];
|
||||
|
||||
return (
|
||||
|
|
|
@ -11,7 +11,7 @@ interface ChatResponseMessagesProps {
|
|||
|
||||
export const ChatResponseMessages: React.FC<ChatResponseMessagesProps> = React.memo(
|
||||
({ isCompletedStream, messageId }) => {
|
||||
const responseMessageIds = useGetChatMessage(messageId, (x) => x?.response_message_ids || []);
|
||||
const responseMessageIds = useGetChatMessage(messageId, (x) => x?.response_message_ids || [])!;
|
||||
const lastReasoningMessageId = useGetChatMessage(
|
||||
messageId,
|
||||
(x) => x?.reasoning_message_ids?.[x.reasoning_message_ids.length - 1]
|
||||
|
|
Loading…
Reference in New Issue