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<{
|
||||
chatTitle: string;
|
||||
chatId: string;
|
||||
isStreamFinished: boolean;
|
||||
}> = ({ chatTitle, chatId, isStreamFinished }) => {
|
||||
isStreamingMessage: boolean;
|
||||
}> = ({ chatTitle, chatId, isStreamingMessage }) => {
|
||||
const { mutateAsync: updateChat } = useUpdateChat();
|
||||
const isStreamFinished = !isStreamingMessage;
|
||||
|
||||
if (!chatTitle) {
|
||||
return <div />; //we need to return something for alignment
|
||||
|
@ -26,8 +27,11 @@ export const ChatHeaderTitle: React.FC<{
|
|||
return (
|
||||
<AnimatePresence mode="wait" initial={isStreamFinished}>
|
||||
<motion.div
|
||||
{...(!isStreamFinished ? animation : {})}
|
||||
{...(isStreamFinished ? {} : animation)}
|
||||
key={chatTitle || 'initial'}
|
||||
transition={{
|
||||
duration: isStreamFinished ? 0 : 0.2,
|
||||
}}
|
||||
className="flex w-full items-center overflow-hidden"
|
||||
>
|
||||
<EditableTitle
|
||||
|
|
|
@ -22,9 +22,12 @@ export const useIsStreamingMessage = () => {
|
|||
const isStreamingMessage = useQueries({
|
||||
queries: stableQueries,
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -7,14 +7,14 @@ import { useGetChatId } from '@/context/Chats/useGetChatId';
|
|||
export const ChatHeader: React.FC = React.memo(() => {
|
||||
const chatId = useGetChatId();
|
||||
const chatTitle = useGetActiveChatTitle();
|
||||
const isStreamFinished = useIsStreamingMessage();
|
||||
const isStreamingMessage = useIsStreamingMessage();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ChatHeaderTitle
|
||||
chatTitle={chatTitle || ''}
|
||||
chatId={chatId || ''}
|
||||
isStreamFinished={isStreamFinished}
|
||||
isStreamingMessage={isStreamingMessage}
|
||||
/>
|
||||
<ChatHeaderOptions />
|
||||
</>
|
||||
|
|
Loading…
Reference in New Issue