mirror of https://github.com/buster-so/buster.git
put toaster back in place
This commit is contained in:
parent
8cfccc7bc1
commit
e8081b0df1
|
@ -1,5 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { Toaster } from '@/components/ui/toaster/Toaster';
|
||||||
import React, { PropsWithChildren } from 'react';
|
import React, { PropsWithChildren } from 'react';
|
||||||
import { toast, type ExternalToast } from 'sonner';
|
import { toast, type ExternalToast } from 'sonner';
|
||||||
import { useContextSelector, createContext } from 'use-context-selector';
|
import { useContextSelector, createContext } from 'use-context-selector';
|
||||||
|
@ -167,7 +168,7 @@ export const BusterNotificationsProvider: React.FC<PropsWithChildren> = ({ child
|
||||||
return (
|
return (
|
||||||
<BusterNotifications.Provider value={value}>
|
<BusterNotifications.Provider value={value}>
|
||||||
{children}
|
{children}
|
||||||
{/* <Toaster /> */}
|
<Toaster />
|
||||||
</BusterNotifications.Provider>
|
</BusterNotifications.Provider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,8 @@ function makeQueryClient(params?: {
|
||||||
enabled: (params?.enabled ?? true) && baseEnabled,
|
enabled: (params?.enabled ?? true) && baseEnabled,
|
||||||
queryFn: () => Promise.resolve(),
|
queryFn: () => Promise.resolve(),
|
||||||
retry: (failureCount, error) => {
|
retry: (failureCount, error) => {
|
||||||
if (params?.openErrorNotification && failureCount > 0) {
|
if (params?.openErrorNotification) {
|
||||||
params.openErrorNotification(error);
|
// params.openErrorNotification(error);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import type { SelectedFile } from '../interfaces';
|
||||||
import { useAutoChangeLayout } from './useAutoChangeLayout';
|
import { useAutoChangeLayout } from './useAutoChangeLayout';
|
||||||
import { useGetChat } from '@/api/buster_rest/chats';
|
import { useGetChat } from '@/api/buster_rest/chats';
|
||||||
import { useMessageIndividual } from '@/context/Chats';
|
import { useMessageIndividual } from '@/context/Chats';
|
||||||
|
import { useQueries } from '@tanstack/react-query';
|
||||||
|
import { queryKeys } from '@/api/query_keys';
|
||||||
|
import { IBusterChatMessage } from '@/api/asset_interfaces/chat';
|
||||||
|
|
||||||
const useChatIndividualContext = ({
|
const useChatIndividualContext = ({
|
||||||
chatId,
|
chatId,
|
||||||
|
@ -28,7 +31,19 @@ const useChatIndividualContext = ({
|
||||||
|
|
||||||
//MESSAGES
|
//MESSAGES
|
||||||
const currentMessageId = chatMessageIds[chatMessageIds.length - 1];
|
const currentMessageId = chatMessageIds[chatMessageIds.length - 1];
|
||||||
const isStreamingMessage = useMessageIndividual(currentMessageId, (x) => !x?.isCompletedStream);
|
|
||||||
|
const isStreamingMessage = useQueries({
|
||||||
|
queries: chatMessageIds.map((messageId) => {
|
||||||
|
const queryKey = queryKeys.chatsMessages(messageId);
|
||||||
|
return {
|
||||||
|
...queryKey,
|
||||||
|
select: (data: IBusterChatMessage | undefined) => !data?.isCompletedStream,
|
||||||
|
enabled: false
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}).some((query) => query.data);
|
||||||
|
|
||||||
|
console.log('isCompletedStreamQueries', isStreamingMessage);
|
||||||
|
|
||||||
useAutoChangeLayout({
|
useAutoChangeLayout({
|
||||||
lastMessageId: currentMessageId,
|
lastMessageId: currentMessageId,
|
||||||
|
|
Loading…
Reference in New Issue