Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🏁 style: Align Streaming Elapsed Reading With Footer Start (#15720)
Danny Avila25fcd12ad4ec
diff --git a/client/src/components/Chat/Messages/MessageParts.tsx b/client/src/components/Chat/Messages/MessageParts.tsxindex 19aee8b90c..9a909b9cc0 100644--- a/client/src/components/Chat/Messages/MessageParts.tsx+++ b/client/src/components/Chat/Messages/MessageParts.tsx@@ -127,6 +127,17 @@ function MessageParts(props: TMessageProps) {isEditing={edit}footer={<SubRow classes={cn(messageFooterClasses, isCreatedByUser && 'justify-end')}>+ {/* The reading holds the column start: it takes over the slot the streaming+ dot vacates, so the retry navigation beside it — whose width the footer+ reserves whether or not hover has revealed it — must never push the+ timer inboard of that column. */}+ {shouldShowElapsed({+ isSubmitting,+ isLatestMessage: messageId === latestMessageId,+ isCreatedByUser,+ siblingIdx,+ siblingCount,+ }) && <Elapsed index={index} />}{/* While the answer is generating every other action is withheld, whichwould otherwise leave this counter sitting alone under a half-writtenresponse. It reveals on hover there, like the actions it sits with. */}@@ -138,13 +149,6 @@ function MessageParts(props: TMessageProps) {isSubmitting && messageId === latestMessageId && revealOnRowHoverClasses,)}/>- {shouldShowElapsed({- isSubmitting,- isLatestMessage: messageId === latestMessageId,- isCreatedByUser,- siblingIdx,- siblingCount,- }) && <Elapsed index={index} />}<HoverButtonsindex={index}isEditing={edit}diff --git a/client/src/components/Chat/Messages/__tests__/HoverActions.streaming.spec.tsx b/client/src/components/Chat/Messages/__tests__/HoverActions.streaming.spec.tsxindex e091805766..5cfbc3a95d 100644--- a/client/src/components/Chat/Messages/__tests__/HoverActions.streaming.spec.tsx+++ b/client/src/components/Chat/Messages/__tests__/HoverActions.streaming.spec.tsx@@ -8,6 +8,7 @@ import { QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/reacimport { useLatestMessage, useLatestMessageId } from '~/hooks/Messages/useLatestMessage';import { ChatContext, MessagesViewProvider, useChatContext } from '~/Providers';import StructuredMessage from '~/components/Messages/MessageContent';+import MessageParts from '~/components/Chat/Messages/MessageParts';import Message from '~/components/Chat/Messages/Message';import store from '~/store';@@ -53,8 +54,10 @@ jest.mock('~/hooks', () => {const useMemoizedChatContext = jest.requireActual('~/hooks/Messages/useMemoizedChatContext',).default;+ const useMessageHelpers = jest.requireActual('~/hooks/Messages/useMessageHelpers').default;return {useMessageProcess,+ useMessageHelpers,useMemoizedChatContext,useContentMetadata: () => ({ hasParallelContent: false }),useAttachments: () => ({ attachments: [], searchResults: undefined }),@@ -140,14 +143,18 @@ function createQueryClient() {});}+type RowComponent = typeof Message;+function DerivedStreamingRow({structured = false,submitting = true,siblingIdx = 1,+ row,}: {structured?: boolean;submitting?: boolean;siblingIdx?: number;+ row?: RowComponent;}) {const queryClient = useQueryClient();const latestMessage = useLatestMessage(0);@@ -183,7 +190,7 @@ function DerivedStreamingRow({return null;}- const MessageComponent = structured ? StructuredMessage : Message;+ const MessageComponent = row ?? (structured ? StructuredMessage : Message);return (<ChatContext.Provider value={chatContext}><MessagesViewProvider>@@ -200,7 +207,12 @@ function DerivedStreamingRow({);}-function renderStreamingRow(structured = false, submitting = true, siblingIdx = 1) {+function renderStreamingRow(+ structured = false,+ submitting = true,+ siblingIdx = 1,+ row?: RowComponent,+) {const queryClient = createQueryClient();queryClient.setQueryData<TMessage[]>([QueryKeys.messages, conversation.conversationId],@@ -220,6 +232,7 @@ function renderStreamingRow(structured = false, submitting = true, siblingIdx =structured={structured}submitting={submitting}siblingIdx={siblingIdx}+ row={row}/></MemoryRouter></RecoilRoot>@@ -316,6 +329,26 @@ describe('streaming hover actions', () => {expect(screen.getByTestId('stream-elapsed')).toBeInTheDocument();});+ /**+ * The retry navigation holds its width in the footer whether or not hover has+ * revealed it, so a row with siblings would otherwise indent the timer past the+ * column the streaming dot just vacated. The reading stays at the column start.+ */+ it.each([+ ['a plain text', Message],+ ['a structured', StructuredMessage],+ ['a flat-thread', MessageParts],+ ])('keeps the elapsed reading left-most in %s streaming footer', (_label, row) => {+ renderStreamingRow(false, true, 1, row);++ const timer = screen.getByTestId('stream-elapsed');+ const footer = screen.getByRole('navigation', {+ name: 'com_ui_sibling_navigation',+ }).parentElement;++ expect(footer?.firstElementChild).toContainElement(timer);+ });+it('renders no elapsed timer once the row is not submitting', () => {renderStreamingRow(false, false);diff --git a/client/src/components/Chat/Messages/ui/MessageRender.tsx b/client/src/components/Chat/Messages/ui/MessageRender.tsxindex 73bd0a1825..0770506378 100644--- a/client/src/components/Chat/Messages/ui/MessageRender.tsx+++ b/client/src/components/Chat/Messages/ui/MessageRender.tsx@@ -173,6 +173,17 @@ const MessageRender = memo(function MessageRender({plain={wakeupDisplay != null && !edit}footer={<SubRow classes={cn(messageFooterClasses, msg.isCreatedByUser && 'justify-end')}>+ {/* The reading holds the column start: it takes over the slot the streaming+ dot vacates, so the retry navigation beside it — whose width the footer+ reserves whether or not hover has revealed it — must never push the+ timer inboard of that column. */}+ {shouldShowElapsed({+ isSubmitting,+ isLatestMessage,+ isCreatedByUser: msg.isCreatedByUser,+ siblingIdx,+ siblingCount,+ }) && <Elapsed index={index} />}{/* A user turn is right-aligned, so its retry navigation belongs at theouter edge under the bubble rather than inboard of the actions.@@ -188,13 +199,6 @@ const MessageRender = memo(function MessageRender({isSubmitting && isLatestMessage && revealOnRowHoverClasses,)}/>- {shouldShowElapsed({- isSubmitting,- isLatestMessage,- isCreatedByUser: msg.isCreatedByUser,- siblingIdx,- siblingCount,- }) && <Elapsed index={index} />}<HoverButtonsindex={index}isEditing={edit}diff --git a/client/src/components/Messages/ContentRender.tsx b/client/src/components/Messages/ContentRender.tsxindex 7d0138891a..6b59006340 100644--- a/client/src/components/Messages/ContentRender.tsx+++ b/client/src/components/Messages/ContentRender.tsx@@ -173,6 +173,17 @@ const ContentRender = memo(function ContentRender({isEditing={edit}footer={<SubRow classes={cn(messageFooterClasses, msg.isCreatedByUser && 'justify-end')}>+ {/* The reading holds the column start: it takes over the slot the streaming+ dot vacates, so the retry navigation beside it — whose width the footer+ reserves whether or not hover has revealed it — must never push the+ timer inboard of that column. */}+ {shouldShowElapsed({+ isSubmitting,+ isLatestMessage,+ isCreatedByUser: msg.isCreatedByUser,+ siblingIdx,+ siblingCount,+ }) && <Elapsed index={index} />}{/* While the answer is generating every other action is withheld, whichwould otherwise leave this counter sitting alone under a half-writtenresponse. It reveals on hover there, like the actions it sits with. */}@@ -182,13 +193,6 @@ const ContentRender = memo(function ContentRender({setSiblingIdx={setSiblingIdx}className={cn(isSubmitting && isLatestMessage && revealOnRowHoverClasses)}/>- {shouldShowElapsed({- isSubmitting,- isLatestMessage,- isCreatedByUser: msg.isCreatedByUser,- siblingIdx,- siblingCount,- }) && <Elapsed index={index} />}<HoverButtonsindex={index}message={msg}