mirror of https://github.com/buster-so/buster.git
no duration for streaming messages
This commit is contained in:
parent
2705b180ac
commit
1a46465aaa
|
@ -15,9 +15,10 @@ export const CHAT_HEADER_TITLE_ID = 'chat-header-title';
|
||||||
export const ChatHeaderTitle: React.FC<{
|
export const ChatHeaderTitle: React.FC<{
|
||||||
chatTitle: string;
|
chatTitle: string;
|
||||||
chatId: string;
|
chatId: string;
|
||||||
isStreamFinished: boolean;
|
isStreamingMessage: boolean;
|
||||||
}> = ({ chatTitle, chatId, isStreamFinished }) => {
|
}> = ({ chatTitle, chatId, isStreamingMessage }) => {
|
||||||
const { mutateAsync: updateChat } = useUpdateChat();
|
const { mutateAsync: updateChat } = useUpdateChat();
|
||||||
|
const isStreamFinished = !isStreamingMessage;
|
||||||
|
|
||||||
if (!chatTitle) {
|
if (!chatTitle) {
|
||||||
return <div />; //we need to return something for alignment
|
return <div />; //we need to return something for alignment
|
||||||
|
@ -26,8 +27,11 @@ export const ChatHeaderTitle: React.FC<{
|
||||||
return (
|
return (
|
||||||
<AnimatePresence mode="wait" initial={isStreamFinished}>
|
<AnimatePresence mode="wait" initial={isStreamFinished}>
|
||||||
<motion.div
|
<motion.div
|
||||||
{...(!isStreamFinished ? animation : {})}
|
{...(isStreamFinished ? {} : animation)}
|
||||||
key={chatTitle || 'initial'}
|
key={chatTitle || 'initial'}
|
||||||
|
transition={{
|
||||||
|
duration: isStreamFinished ? 0 : 0.2,
|
||||||
|
}}
|
||||||
className="flex w-full items-center overflow-hidden"
|
className="flex w-full items-center overflow-hidden"
|
||||||
>
|
>
|
||||||
<EditableTitle
|
<EditableTitle
|
||||||
|
|
|
@ -22,9 +22,12 @@ export const useIsStreamingMessage = () => {
|
||||||
const isStreamingMessage = useQueries({
|
const isStreamingMessage = useQueries({
|
||||||
queries: stableQueries,
|
queries: stableQueries,
|
||||||
combine: useCallback(
|
combine: useCallback(
|
||||||
(result: { data: boolean | undefined }[]) => result.some((res) => res.data === false),
|
(result: { data: boolean | undefined }[]) => {
|
||||||
[]
|
return result.some((res) => res.data === false);
|
||||||
|
},
|
||||||
|
[stableQueries]
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
return isStreamingMessage;
|
return isStreamingMessage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,14 +7,14 @@ import { useGetChatId } from '@/context/Chats/useGetChatId';
|
||||||
export const ChatHeader: React.FC = React.memo(() => {
|
export const ChatHeader: React.FC = React.memo(() => {
|
||||||
const chatId = useGetChatId();
|
const chatId = useGetChatId();
|
||||||
const chatTitle = useGetActiveChatTitle();
|
const chatTitle = useGetActiveChatTitle();
|
||||||
const isStreamFinished = useIsStreamingMessage();
|
const isStreamingMessage = useIsStreamingMessage();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ChatHeaderTitle
|
<ChatHeaderTitle
|
||||||
chatTitle={chatTitle || ''}
|
chatTitle={chatTitle || ''}
|
||||||
chatId={chatId || ''}
|
chatId={chatId || ''}
|
||||||
isStreamFinished={isStreamFinished}
|
isStreamingMessage={isStreamingMessage}
|
||||||
/>
|
/>
|
||||||
<ChatHeaderOptions />
|
<ChatHeaderOptions />
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in New Issue