mirror of https://github.com/buster-so/buster.git
minor tweaks to listerns
This commit is contained in:
parent
392010e722
commit
c20cbb8501
|
@ -38,12 +38,12 @@ export const useChatUpdate = () => {
|
|||
const options = queryKeys.chatsMessages(newMessageConfig.id);
|
||||
const queryKey = options.queryKey;
|
||||
const currentData = queryClient.getQueryData(queryKey);
|
||||
|
||||
const iChatMessage = create(currentData!, (draft) => {
|
||||
Object.assign(draft, newMessageConfig);
|
||||
});
|
||||
|
||||
queryClient.setQueryData(queryKey, iChatMessage);
|
||||
if (currentData) {
|
||||
const iChatMessage = create(currentData, (draft) => {
|
||||
Object.assign(draft, newMessageConfig);
|
||||
});
|
||||
queryClient.setQueryData(queryKey, iChatMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -107,6 +107,10 @@ export const useBusterNewChat = () => {
|
|||
|
||||
const onFollowUpChat = useMemoizedFn(
|
||||
async ({ prompt, chatId }: { prompt: string; chatId: string }) => {
|
||||
busterSocket.once({
|
||||
route: '/chats/post:initializeChat',
|
||||
callback: initializeNewChatCallback
|
||||
});
|
||||
await busterSocket.emitAndOnce({
|
||||
emitEvent: {
|
||||
route: '/chats/post',
|
||||
|
|
|
@ -37,10 +37,12 @@ export const useChatStreamMessage = () => {
|
|||
|
||||
const onUpdateChatMessageTransition = useMemoizedFn(
|
||||
(chatMessage: Parameters<typeof onUpdateChatMessage>[0]) => {
|
||||
const currentChatMessage = chatRefMessages.current[chatMessage.id];
|
||||
const currentChatMessage = chatRefMessages.current[chatMessage.id] || {};
|
||||
const iChatMessage: IBusterChatMessage = create(currentChatMessage, (draft) => {
|
||||
Object.assign(draft || {}, chatMessage);
|
||||
if (chatMessage.id) draft.id = chatMessage.id;
|
||||
if (chatMessage.id) {
|
||||
draft.id = chatMessage.id;
|
||||
}
|
||||
})!;
|
||||
chatRefMessages.current[chatMessage.id] = iChatMessage;
|
||||
|
||||
|
@ -106,9 +108,12 @@ export const useChatStreamMessage = () => {
|
|||
|
||||
const _generatingTitleCallback = useMemoizedFn((_: null, newData: ChatEvent_GeneratingTitle) => {
|
||||
const { chat_id } = newData;
|
||||
const updatedChat = updateChatTitle(chatRef.current[chat_id], newData);
|
||||
chatRef.current[chat_id] = updatedChat;
|
||||
onUpdateChat(updatedChat);
|
||||
const currentChat = chatRef.current[chat_id];
|
||||
if (currentChat) {
|
||||
const updatedChat = updateChatTitle(currentChat, newData);
|
||||
chatRef.current[chat_id] = updatedChat;
|
||||
onUpdateChat(updatedChat);
|
||||
}
|
||||
});
|
||||
|
||||
const _generatingResponseMessageCallback = useMemoizedFn(
|
||||
|
|
|
@ -119,7 +119,7 @@ const AnimatedThoughtTitle = React.memo(
|
|||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ delay: 0.125 }}
|
||||
transition={{ delay: isSecondaryTitle ? 0.3 : 0.125 }}
|
||||
key={title}>
|
||||
<Text
|
||||
size="sm"
|
||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
|||
import { MessageContainer } from '../MessageContainer';
|
||||
import { ChatResponseMessageSelector } from './ChatResponseMessageSelector';
|
||||
import { ChatResponseReasoning } from './ChatResponseReasoning';
|
||||
import { ShimmerText } from '@/components/ui/typography/ShimmerText';
|
||||
import { useMessageIndividual } from '@/context/Chats';
|
||||
|
||||
interface ChatResponseMessagesProps {
|
||||
|
|
|
@ -55,10 +55,12 @@ export const ChatResponseReasoning: React.FC<{
|
|||
<motion.div
|
||||
{...animations}
|
||||
key={text}
|
||||
className="mb-3.5 w-fit cursor-pointer"
|
||||
className="mb-3.5 h-[14px] max-h-[14px] w-fit cursor-pointer"
|
||||
onClick={onClickReasoning}>
|
||||
{isReasonginFileSelected ? (
|
||||
<Text className="hover:underline">{text}</Text>
|
||||
<Text className="text-text-secondary hover:text-text-default hover:underline">
|
||||
{text}
|
||||
</Text>
|
||||
) : (
|
||||
<ShimmerText text={text ?? ''} />
|
||||
)}
|
||||
|
|
|
@ -11,7 +11,7 @@ export const ChatUserMessage: React.FC<{ requestMessage: BusterChatMessageReques
|
|||
|
||||
return (
|
||||
<MessageContainer senderName={sender_name} senderId={sender_id} senderAvatar={sender_avatar}>
|
||||
<Paragraph className="text-sm">{request}</Paragraph>
|
||||
<Paragraph>{request}</Paragraph>
|
||||
</MessageContainer>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ export const useAutoChangeLayout = ({
|
|||
const isCompletedStream = useMessageIndividual(lastMessageId, (x) => x?.isCompletedStream);
|
||||
const hasReasoning = !!reasoningMessagesLength;
|
||||
|
||||
console.log('lastMessageId', lastMessageId, hasReasoning);
|
||||
|
||||
//change the page to reasoning file if we get a reasoning message
|
||||
useEffect(() => {
|
||||
if (!isCompletedStream && hasReasoning && previousLastMessageId.current !== lastMessageId) {
|
||||
|
|
Loading…
Reference in New Issue