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
|
enabled: false, //this will come from the chat
|
||||||
select: selector
|
select: selector
|
||||||
});
|
});
|
||||||
return data || ({} as TData);
|
return data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,20 +67,18 @@ export const ReasoningMessageSelector: React.FC<ReasoningMessageSelectorProps> =
|
||||||
chatId,
|
chatId,
|
||||||
messageId
|
messageId
|
||||||
}) => {
|
}) => {
|
||||||
const { title, type, secondary_title, status, hasMessage } = useGetChatMessage(
|
const messageStuff = useGetChatMessage(messageId, (x) => ({
|
||||||
messageId,
|
|
||||||
(x) => ({
|
|
||||||
title: x?.reasoning_messages[reasoningMessageId]?.title,
|
title: x?.reasoning_messages[reasoningMessageId]?.title,
|
||||||
secondary_title: x?.reasoning_messages[reasoningMessageId]?.secondary_title,
|
secondary_title: x?.reasoning_messages[reasoningMessageId]?.secondary_title,
|
||||||
type: x?.reasoning_messages[reasoningMessageId]?.type,
|
type: x?.reasoning_messages[reasoningMessageId]?.type,
|
||||||
status: x?.reasoning_messages[reasoningMessageId]?.status,
|
status: x?.reasoning_messages[reasoningMessageId]?.status,
|
||||||
hasMessage: !!(x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_text)
|
hasMessage: !!(x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_text)
|
||||||
?.message
|
?.message
|
||||||
})
|
}));
|
||||||
);
|
const { title, secondary_title, type, status, hasMessage } = messageStuff || {};
|
||||||
|
|
||||||
const showBar = useMemo(() => {
|
const showBar = useMemo(() => {
|
||||||
if (type === 'text') return hasMessage;
|
if (type === 'text') return !!hasMessage;
|
||||||
return true;
|
return true;
|
||||||
}, [type, hasMessage]);
|
}, [type, hasMessage]);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ export const ChatResponseMessageSelector: React.FC<ChatResponseMessageSelectorPr
|
||||||
const messageType = useGetChatMessage(
|
const messageType = useGetChatMessage(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => x?.response_messages?.[responseMessageId]?.type || 'text'
|
(x) => x?.response_messages?.[responseMessageId]?.type || 'text'
|
||||||
);
|
)!;
|
||||||
const ChatResponseMessage = ChatResponseMessageRecord[messageType];
|
const ChatResponseMessage = ChatResponseMessageRecord[messageType];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface ChatResponseMessagesProps {
|
||||||
|
|
||||||
export const ChatResponseMessages: React.FC<ChatResponseMessagesProps> = React.memo(
|
export const ChatResponseMessages: React.FC<ChatResponseMessagesProps> = React.memo(
|
||||||
({ isCompletedStream, messageId }) => {
|
({ isCompletedStream, messageId }) => {
|
||||||
const responseMessageIds = useGetChatMessage(messageId, (x) => x?.response_message_ids || []);
|
const responseMessageIds = useGetChatMessage(messageId, (x) => x?.response_message_ids || [])!;
|
||||||
const lastReasoningMessageId = useGetChatMessage(
|
const lastReasoningMessageId = useGetChatMessage(
|
||||||
messageId,
|
messageId,
|
||||||
(x) => x?.reasoning_message_ids?.[x.reasoning_message_ids.length - 1]
|
(x) => x?.reasoning_message_ids?.[x.reasoning_message_ids.length - 1]
|
||||||
|
|
Loading…
Reference in New Issue