mirror of https://github.com/buster-so/buster.git
follow up with the chat
This commit is contained in:
parent
06ad7032e7
commit
4f94ea29d0
|
@ -42,14 +42,12 @@ export const useStopChat = () => {
|
|||
currentChat.message_ids.forEach((messageId) => {
|
||||
queryClient.setQueryData(chatQueryKeys.chatsMessages(messageId).queryKey, (v) => {
|
||||
if (v) {
|
||||
return {
|
||||
...v,
|
||||
is_completed: true,
|
||||
};
|
||||
return { ...v, is_completed: true };
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: chatQueryKeys.chatsGetList().queryKey,
|
||||
refetchType: 'all',
|
||||
|
|
|
@ -58,7 +58,6 @@ export const WithValue: Story = {
|
|||
{...args}
|
||||
value={value}
|
||||
onChange={(v) => {
|
||||
console.log('onChange', v);
|
||||
setValue(v);
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -18,7 +18,7 @@ type StartChatParams = {
|
|||
export const useChat = () => {
|
||||
const navigate = useNavigate();
|
||||
const { mutateAsync: startNewChat, isPending: isSubmittingChat } = useStartNewChat();
|
||||
const { mutate: stopChatMutation } = useStopChat();
|
||||
const { mutateAsync: stopChatMutation } = useStopChat();
|
||||
const getChatMemoized = useGetChatMemoized();
|
||||
const getChatMessageMemoized = useGetChatMessageMemoized();
|
||||
const { onUpdateChat, onUpdateChatMessage } = useChatUpdate();
|
||||
|
@ -82,8 +82,8 @@ export const useChat = () => {
|
|||
}
|
||||
);
|
||||
|
||||
const onStopChat = useMemoizedFn(({ chatId }: { chatId: string }) => {
|
||||
stopChatMutation(chatId);
|
||||
const onStopChat = useMemoizedFn(async ({ chatId }: { chatId: string }) => {
|
||||
return await stopChatMutation(chatId);
|
||||
});
|
||||
|
||||
const onReplaceMessageInChat = useMemoizedFn(
|
||||
|
|
|
@ -58,7 +58,6 @@ export const useChatInputFlow = ({
|
|||
submittingCooldown.current = true;
|
||||
|
||||
if (isChatMode || selectedAssetType === 'chat') {
|
||||
console.log('following up chat');
|
||||
await onFollowUpChat({ prompt: trimmedInputValue, chatId });
|
||||
} else if (selectedAssetType === 'collection') {
|
||||
// maybe we will support this one day. Good day that'll be. Until then, we will just dream.
|
||||
|
|
|
@ -27,7 +27,6 @@ export const useAutoRedirectStreaming = ({
|
|||
const isFinishedReasoning = useGetChatMessageIsFinishedReasoning({ messageId: lastMessageId });
|
||||
const hasResponseFile = useGetChatMessageHasResponseFile({ messageId: lastMessageId });
|
||||
|
||||
const previousLastMessageId = useRef<string | null>(null);
|
||||
const previousIsCompletedStream = useRef<boolean>(isStreamFinished);
|
||||
|
||||
const hasLoadedChat = useHasLoadedChat({ chatId: chatId || '' });
|
||||
|
@ -70,7 +69,6 @@ export const useAutoRedirectStreaming = ({
|
|||
|
||||
//this will trigger when the chat is streaming and is has not completed yet (new chat)
|
||||
else if (!isStreamFinished && !isFinishedReasoning && hasReasoning && chatId) {
|
||||
previousLastMessageId.current = lastMessageId;
|
||||
navigate({
|
||||
to: '/app/chats/$chatId/reasoning/$messageId',
|
||||
params: {
|
||||
|
@ -93,5 +91,5 @@ export const useAutoRedirectStreaming = ({
|
|||
replace: true,
|
||||
});
|
||||
}
|
||||
}, [isStreamFinished, hasReasoning, hasResponseFile, chatId, lastMessageId]); //only use these values to trigger the useEffect
|
||||
}, [isStreamFinished, hasReasoning, hasResponseFile, chatId, lastMessageId, isFinishedReasoning]); //only use these values to trigger the useEffect
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ function RouteComponent() {
|
|||
);
|
||||
}
|
||||
|
||||
const ReasoningControllerHeader: React.FC<{}> = () => {
|
||||
const ReasoningControllerHeader: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full flex items-center justify-between">
|
||||
<AppSegmented
|
||||
|
|
Loading…
Reference in New Issue