Skip to content

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

🧽 style: Composer, Welcome Screen and Context Panel Polish (#15838)

Marco Beretta1bea7e4c9eaf
diff --git a/client/package.json b/client/package.json
index 669107f62b..a8f070957c 100644
--- a/client/package.json
+++ b/client/package.json
@@ -80,8 +80,8 @@
"js-cookie": "^3.0.5",
"librechat-data-provider": "*",
"lodash": "^4.17.23",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.528.0",
+ "lucide-react": "^0.528.0",
"match-sorter": "^8.1.0",
"mdast-util-directive": "^3.0.0",
"mdast-util-from-markdown": "^2.0.1",
diff --git a/client/src/components/Chat/ChatView.tsx b/client/src/components/Chat/ChatView.tsx
index 96b0ad732a..de800d6eb4 100644
--- a/client/src/components/Chat/ChatView.tsx
+++ b/client/src/components/Chat/ChatView.tsx
@@ -8,6 +8,7 @@ import { Constants, buildTree } from 'librechat-data-provider';
import type { TChatProject } from 'librechat-data-provider';
import type { ChatFormValues } from '~/common';
import {
+ useScrollbarGutterSeed,
useAddedResponse,
useResumeOnLoad,
useAdaptiveSSE,
@@ -20,13 +21,13 @@ import ApprovalProvider from './Messages/Content/ApprovalContext';
import ConversationStarters from './Input/ConversationStarters';
import { pendingApprovalActionFamily } from './approval/state';
import { useGetMessagesByConvoId } from '~/data-provider';
+import Footer, { useConfiguredFooter } from './Footer';
import { AskAnswerHostProvider } from './ask/state';
import MessagesView from './Messages/MessagesView';
import Presentation from './Presentation';
import ChatForm from './Input/ChatForm';
import Landing from './Landing';
import Header from './Header';
-import Footer from './Footer';
import { cn } from '~/utils';
import store from '~/store';
@@ -51,6 +52,15 @@ function ChatView({ index = 0, project }: { index?: number; project?: TChatProje
pendingApprovalActionFamily(conversationId ?? Constants.NEW_CONVO),
);
+ /** The welcome screen reserves the message column's scrollbar band before any
+ * column exists to measure it (see the column's class list below). */
+ useScrollbarGutterSeed();
+
+ /** A conversation carries a footer only for configured content, and the
+ * composer's clearance has to account for the bar when it does — including
+ * while the config is still in flight, so a cold load does not jump. */
+ const configuredFooter = useConfiguredFooter();
+
const methods = useForm<ChatFormValues>({
defaultValues: { text: '' },
});
@@ -101,6 +111,12 @@ function ChatView({ index = 0, project }: { index?: number; project?: TChatProje
const isLandingPage =
(!messagesTree || messagesTree.length === 0) &&
(conversationId === Constants.NEW_CONVO || !conversationId);
+
+ /** A footer bar renders beneath the composer on the welcome screen always, and
+ * in a conversation when the deployment configured one. `present` already
+ * carries the remembered answer while the config is in flight, so this is the
+ * same value before and after it resolves. */
+ const footerBelow = isLandingPage || configuredFooter.present;
const isNavigating = (!messagesTree || messagesTree.length === 0) && conversationId != null;
const isProjectLandingPage = isLandingPage && project != null;
@@ -151,7 +167,15 @@ function ChatView({ index = 0, project }: { index?: number; project?: TChatProje
className={cn(
'flex flex-col',
isLandingPage
- ? 'flex-1 items-center justify-end sm:justify-center'
+ ? /* The gutter is reserved once per state, wherever the
+ centring happens. A conversation centres the composer
+ inside the band below, against a message column that
+ holds the scrollbar band back; the landing page centres
+ this whole column instead, greeting and composer
+ together, so it holds the same band back here. Without
+ it the composer lands 4px right of where a conversation
+ puts it and slides sideways on the way in. */
+ 'scrollbar-gutter-spacer flex-1 items-center justify-end sm:justify-center'
: 'h-full overflow-y-auto',
)}
>
@@ -181,9 +205,15 @@ function ChatView({ index = 0, project }: { index?: number; project?: TChatProje
index={index}
placeholder={chatFormPlaceholder}
project={isProjectLandingPage ? project : undefined}
+ isLandingPage={isLandingPage}
+ footerBelow={footerBelow}
+ centerFormOnLanding={centerFormOnLanding}
/>
)}
- {!isLandingPage && <Footer />}
+ {/* The generic disclaimer is the welcome screen's; a
+ deployment's own footer, privacy policy and terms
+ stay with the conversation that always showed them. */}
+ {!isLandingPage && configuredFooter.present && <Footer configuredOnly />}
</div>
</div>
{isLandingPage && <Footer />}
diff --git a/client/src/components/Chat/Footer.tsx b/client/src/components/Chat/Footer.tsx
index 31cc0d48ee..005802b6f8 100644
--- a/client/src/components/Chat/Footer.tsx
+++ b/client/src/components/Chat/Footer.tsx
@@ -1,21 +1,69 @@
import React, { useEffect, memo } from 'react';
+import { useAtom } from 'jotai';
import TagManager from 'react-gtm-module';
import ReactMarkdown from 'react-markdown';
import { Constants } from 'librechat-data-provider';
import type { TStartupConfig } from 'librechat-data-provider';
import { useGetStartupConfig } from '~/data-provider';
+import { configuredFooterAtom } from './footerMemory';
import { useLocalize } from '~/hooks';
type FooterProps = {
className?: string;
startupConfig?: FooterStartupConfig | null;
+ /** A started conversation keeps only what the deployment configured. The
+ * generic model disclaimer belongs to the welcome screen, where it is first
+ * read, but a custom footer, a privacy policy and terms of service are the
+ * operator's own content: scoping the disclaimer out must not take their
+ * configuration off the screen that used to carry it. With nothing
+ * configured, this renders nothing at all. */
+ configuredOnly?: boolean;
};
type FooterStartupConfig = Pick<Partial<TStartupConfig>, 'analyticsGtmId' | 'customFooter'> & {
interface?: Pick<NonNullable<TStartupConfig['interface']>, 'privacyPolicy' | 'termsOfService'>;
};
-function Footer({ className, startupConfig }: FooterProps) {
+export type ConfiguredFooter = {
+ /** Whether a footer bar belongs under the composer in a conversation: the
+ * deployment configured a custom footer, a privacy policy or terms of
+ * service. Before the startup config answers this is the answer the last
+ * load recorded, which is what keeps a cold load from laying out twice. */
+ present: boolean;
+ /** The startup config has answered on this load. */
+ resolved: boolean;
+};
+
+/**
+ * What a conversation has to render beneath its composer. The conversation
+ * renders the footer only for configured content, and the composer above it
+ * reserves the band that bar needs — the bar is absolutely positioned in a
+ * zero-height wrapper, so a composer that did not reserve it would be painted
+ * over. Both decisions read this one answer so they cannot disagree.
+ *
+ * While `/api/config` is in flight the answer is the one this deployment gave
+ * last (`configuredFooterAtom`), so a cold load lays out once instead of
+ * guessing and correcting. Only a successful response replaces it: a request
+ * that exhausted its retries has answered nothing.
+ */
+export function useConfiguredFooter(): ConfiguredFooter {
+ const { data: config, isSuccess } = useGetStartupConfig();
+ const [remembered, remember] = useAtom(configuredFooterAtom);
+ const configured =
+ typeof config?.customFooter === 'string' ||
+ config?.interface?.privacyPolicy?.externalUrl != null ||
+ config?.interface?.termsOfService?.externalUrl != null;
+
+ useEffect(() => {
+ if (isSuccess && configured !== remembered) {
+ remember(configured);
+ }
+ }, [configured, isSuccess, remembered, remember]);
+
+ return { present: isSuccess ? configured : remembered, resolved: isSuccess };
+}
+
+function Footer({ className, startupConfig, configuredOnly = false }: FooterProps) {
const shouldFetchConfig = startupConfig === undefined;
const { data: fetchedConfig } = useGetStartupConfig({ enabled: shouldFetchConfig });
const config = shouldFetchConfig ? fetchedConfig : startupConfig;
@@ -25,25 +73,27 @@ function Footer({ className, startupConfig }: FooterProps) {
const termsOfService = config?.interface?.termsOfService;
const privacyPolicyRender = privacyPolicy?.externalUrl != null && (
- <a className="text-text-secondary underline" href={privacyPolicy.externalUrl} rel="noreferrer">
+ <a className="text-text-muted underline" href={privacyPolicy.externalUrl} rel="noreferrer">
{localize('com_ui_privacy_policy')}
</a>
);
const termsOfServiceRender = termsOfService?.externalUrl != null && (
- <a className="text-text-secondary underline" href={termsOfService.externalUrl} rel="noreferrer">
+ <a className="text-text-muted underline" href={termsOfService.externalUrl} rel="noreferrer">
{localize('com_ui_terms_of_service')}
</a>
);
- const mainContentParts = (
- typeof config?.customFooter === 'string'
- ? config.customFooter
- : '[LibreChat ' +
- Constants.VERSION +
- '](https://librechat.ai) - ' +
- localize('com_ui_latest_footer')
- ).split('|');
+ const configuredFooter = typeof config?.customFooter === 'string' ? config.customFooter : null;
+ /** The generic disclaimer is the part a conversation drops; operator content is not. */
+ const genericFooter = configuredOnly
+ ? ''
+ : '[LibreChat ' +
+ Constants.VERSION +
+ '](https://librechat.ai) - ' +
+ localize('com_ui_latest_footer');
+ const mainContent = configuredFooter ?? genericFooter;
+ const mainContentParts = mainContent === '' ? [] : mainContent.split('|');
useEffect(() => {
if (config?.analyticsGtmId != null && typeof window.google_tag_manager === 'undefined') {
@@ -61,7 +111,7 @@ function Footer({ className, startupConfig }: FooterProps) {
a: ({ node: _n, href, children, ...otherProps }) => {
return (
<a
- className="text-text-secondary underline"
+ className="text-text-muted underline"
href={href}
target="_blank"
rel="noopener noreferrer"
@@ -84,12 +134,27 @@ function Footer({ className, startupConfig }: FooterProps) {
Boolean,
);
+ /** A conversation with no configured footer has nothing to place, so it does
+ * not place an empty bar over the bottom of the thread. */
+ if (footerElements.length === 0) {
+ return null;
+ }
+
return (
<div className="relative w-full">
<div
className={
className ??
- 'absolute bottom-0 left-0 right-0 hidden items-center justify-center gap-2 px-2 py-2 text-center text-xs text-text-primary sm:flex md:px-[60px]'
+ /* The disclaimer is the least important text on the landing page and
+ sat in `text-primary`, the same weight as the greeting above it.
+ `text-muted` is the quietest text token that still clears AA for
+ 12px copy on `bg-presentation` — 5.11:1 on white, 7.93:1 on the dark
+ canvas — and the contrast modes collapse every text token to pure
+ black or white, so they stay at 21:1. The links keep the same colour
+ rather than the brighter `text-secondary`: the underline carries the
+ affordance, and a link that outshines its own sentence puts the
+ emphasis back where this change takes it from. */
+ 'absolute bottom-0 left-0 right-0 hidden items-center justify-center gap-2 px-2 py-2 text-center text-xs text-text-muted sm:flex md:px-[60px]'
}
>
{footerElements.map((contentRender, index) => {
diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx
index c1e39ccea2..f7e640a21a 100644
--- a/client/src/components/Chat/Input/ChatForm.tsx
+++ b/client/src/components/Chat/Input/ChatForm.tsx
@@ -74,6 +74,18 @@ interface ChatFormProps {
index: number;
placeholder?: string;
project?: TChatProject;
+ /** Owned by ChatView: which layout the composer sits in — the welcome screen
+ * floats or bottoms it out, a conversation ends the page with it. */
+ isLandingPage: boolean;
+ /** Owned by the host: the app-level preference for where the welcome-screen
+ * composer sits. The chat feature only consumes it. */
+ centerFormOnLanding: boolean;
+ /** Owned by ChatView: whether a footer bar renders under this band. It is an
+ * absolutely positioned bar in a zero-height wrapper, so the clearance here
+ * is the only thing keeping it off the composer. True on the welcome screen,
+ * which always carries one, and in a conversation whose deployment
+ * configured footer content of its own. */
+ footerBelow: boolean;
/** From ChatContext: individual values so memo can compare them */
files: Map<string, ExtendedFile>;
setFiles: FileSetter;
@@ -107,6 +119,9 @@ const ChatForm = memo(function ChatForm({
index,
placeholder,
project,
+ isLandingPage,
+ footerBelow,
+ centerFormOnLanding,
files,
setFiles,
conversation,
@@ -133,7 +148,6 @@ const ChatForm = memo(function ChatForm({
const chatDirection = useRecoilValue(store.chatDirection);
const automaticPlayback = useRecoilValue(store.automaticPlayback);
const maximizeChatSpace = useRecoilValue(store.maximizeChatSpace);
- const centerFormOnLanding = useRecoilValue(store.centerFormOnLanding);
const isTemporary = useRecoilValue(store.isTemporary);
const [badges, setBadges] = useRecoilState(store.chatBadges);
@@ -571,6 +585,23 @@ const ChatForm = memo(function ChatForm({
[isCollapsed, isMoreThanThreeRows],
);
+ /* From `sm` up the band leaves room under itself for the disclaimer, which only
+ the landing page carries — doubled while the centred landing composer floats,
+ and dropped back the moment a submission starts the thread. A started
+ conversation has nothing beneath it, so it keeps only enough to clear the
+ surface's own shadow. Below `sm` the composer runs to the viewport floor in
+ every state. */
+ const landingClearance =
+ centerFormOnLanding && !isSubmitting ? 'transition-all duration-200 sm:mb-28' : 'sm:mb-10';
+ let bottomClearance = 'sm:mb-4';
+ if (isLandingPage) {
+ bottomClearance = landingClearance;
+ } else if (footerBelow) {
+ /* A conversation that carries a configured footer keeps the band that bar
+ needs, exactly as the welcome screen does. */
+ bottomClearance = 'sm:mb-10';
+ }
+
return (
<form
onSubmit={methods.handleSubmit((data) => {
@@ -592,14 +623,16 @@ const ChatForm = memo(function ChatForm({
return submitMessage(data);
})}
className={cn(
- 'mx-auto flex w-full flex-row gap-3 transition-[max-width] duration-300 sm:px-2',
+ /* `margin-bottom` is animated as well as `max-width`: it is what carries
+ the composer between the landing clearance and the conversation one,
+ and the landing page keeps the same form node when a conversation
+ opens, so the band travels instead of jumping. The centred landing
+ composer overrides both with its own `transition-all`, and a reader who
+ asked for less motion gets the new position outright — this one is a
+ slide across the page rather than decoration. */
+ 'mx-auto flex w-full flex-row gap-3 transition-[max-width,margin-bottom] duration-300 motion-reduce:transition-none sm:px-2',
maximizeChatSpace ? 'max-w-full' : 'md:max-w-3xl xl:max-w-4xl',
- centerFormOnLanding &&
- (conversationId == null || conversationId === Constants.NEW_CONVO) &&
- !isSubmitting &&
- conversation?.messages?.length === 0
- ? 'transition-all duration-200 sm:mb-28'
- : 'sm:mb-10',
+ bottomClearance,
)}
>
<div className="relative flex h-full min-w-0 flex-1 items-stretch md:flex-col">
@@ -650,7 +683,11 @@ const ChatForm = memo(function ChatForm({
data-testid="composer-surface"
onClick={handleContainerClick}
className={cn(
- 'relative flex w-full flex-grow flex-col overflow-hidden rounded-t-3xl pb-4 sm:rounded-3xl sm:pb-0',
+ /* The surface runs to the viewport floor below `sm`, where it is
+ squared off at the bottom (`rounded-t-3xl`) and no disclaimer
+ follows it — so the action row is the last thing in it, with no
+ band of padding under the buttons. */
+ 'relative flex w-full flex-grow flex-col overflow-hidden rounded-t-3xl sm:rounded-3xl',
composerSurfaceClasses(),
isTextAreaFocused ? composerSurfaceShadow.focused : composerSurfaceShadow.blurred,
/* Temporary-chat accent is a ChatForm-only override, not part of
@@ -885,10 +922,16 @@ function ChatFormWrapper({
index = 0,
placeholder,
project,
+ isLandingPage,
+ footerBelow,
+ centerFormOnLanding,
}: {
index?: number;
placeholder?: string;
project?: TChatProject;
+ isLandingPage: boolean;
+ footerBelow: boolean;
+ centerFormOnLanding: boolean;
}) {
const {
files,
@@ -953,6 +996,9 @@ function ChatFormWrapper({
index={index}
placeholder={placeholder}
project={project}
+ isLandingPage={isLandingPage}
+ footerBelow={footerBelow}
+ centerFormOnLanding={centerFormOnLanding}
files={files}
setFiles={setFiles}
conversation={stableConversation}
diff --git a/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx b/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
index 6841b51ac4..2b3eb89c2b 100644
--- a/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
@@ -423,6 +423,10 @@ describe('TokenUsage Breakdown', () => {
* the meter. */
expect(cachedRow.parentElement?.className).toContain('pl-6');
expect(cachedRow.textContent).toContain('30');
+ /** The share column is keyed to the window, like every row above: without
+ * it the cached row reads as a bare number beside rows that all carry a
+ * percentage, with the cell left blank. */
+ expect(cachedRow.textContent).toContain('(2%)');
const peers = Array.from(breakdown.children).filter(
(child) => !child.className.includes('pl-6'),
);
diff --git a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
index 83c69b2657..6e008bcab4 100644
--- a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
@@ -410,7 +410,7 @@ export default function Breakdown({
aria-expanded={insightsOpen}
aria-controls={insightsOpen ? insightsId : undefined}
data-testid="context-insights-toggle"
- className="size-6"
+ className="size-6 text-text-secondary"
onFocus={() => setInsightsOpen(true)}
onBlur={() => setInsightsOpen(false)}
onClick={() => setInsightsOpen(true)}
@@ -507,12 +507,14 @@ export default function Breakdown({
<Row
label={localize('com_ui_context_cached')}
value={normalizeTokenCount(view.cacheRead)}
+ max={maxTokens}
/>
)}
{normalizeTokenCount(view.cacheWrite) > 0 && (
<Row
label={localize('com_ui_context_cache_write')}
value={normalizeTokenCount(view.cacheWrite)}
+ max={maxTokens}
/>
)}
</div>
diff --git a/client/src/components/Chat/Input/TokenUsage/index.tsx b/client/src/components/Chat/Input/TokenUsage/index.tsx
index 41b3ad8ce0..f64de3e201 100644
--- a/client/src/components/Chat/Input/TokenUsage/index.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/index.tsx
@@ -232,7 +232,7 @@ function TokenUsageIndicator({
}
}}
className={cn(
- 'z-[200] rounded-xl border border-border-medium bg-surface-secondary p-3 shadow-lg focus:outline-none',
+ 'z-[200] rounded-xl border border-border-medium bg-surface-secondary p-3 text-text-primary shadow-lg focus:outline-none',
'origin-bottom translate-y-1 scale-95 opacity-0 transition-[opacity,transform] duration-150 ease-out motion-reduce:transition-none',
'data-[enter]:translate-y-0 data-[enter]:scale-100 data-[enter]:opacity-100',
'data-[leave]:translate-y-1 data-[leave]:scale-95 data-[leave]:opacity-0',
diff --git a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
index 201e7d6e23..18442369ad 100644
--- a/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/ChatForm.attachments.spec.tsx
@@ -110,7 +110,12 @@ function Harness() {
<ChatFormProvider {...methods}>
<ChatContext.Provider value={chatHelpers}>
<Profiler id="composer" onRender={() => (commits += 1)}>
- <ChatForm index={0} />
+ <ChatForm
+ index={0}
+ isLandingPage={false}
+ footerBelow={false}
+ centerFormOnLanding={false}
+ />
</Profiler>
</ChatContext.Provider>
</ChatFormProvider>
diff --git a/client/src/components/Chat/Input/__tests__/ChatForm.pasteUpload.spec.tsx b/client/src/components/Chat/Input/__tests__/ChatForm.pasteUpload.spec.tsx
index 650099a521..d29222cbda 100644
--- a/client/src/components/Chat/Input/__tests__/ChatForm.pasteUpload.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/ChatForm.pasteUpload.spec.tsx
@@ -108,7 +108,12 @@ function Harness() {
<ChatFormProvider {...methods}>
<ChatContext.Provider value={chatHelpers}>
<DragDropWrapper>
- <ChatForm index={0} />
+ <ChatForm
+ index={0}
+ isLandingPage={false}
+ footerBelow={false}
+ centerFormOnLanding={false}
+ />
</DragDropWrapper>
</ChatContext.Provider>
</ChatFormProvider>
diff --git a/client/src/components/Chat/Landing.tsx b/client/src/components/Chat/Landing.tsx
index 8df1f1e995..607332f23b 100644
--- a/client/src/components/Chat/Landing.tsx
+++ b/client/src/components/Chat/Landing.tsx
@@ -1,7 +1,7 @@
import { useMemo, useCallback, useState, useEffect, useRef } from 'react';
import { useRecoilValue } from 'recoil';
+import { HatGlasses } from 'lucide-react';
import { easings } from '@react-spring/web';
-import { MessageCircleDashed } from 'lucide-react';
import { EModelEndpoint } from 'librechat-data-provider';
import { BirthdayIcon, TooltipAnchor, SplitText } from '@librechat/client';
import {
@@ -160,7 +160,7 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
<div className={`relative size-10 justify-center ${textHasMultipleLines ? 'mb-2' : ''}`}>
{isTemporary ? (
<div className={containerClassName}>
- <MessageCircleDashed className="h-2/3 w-2/3 text-text-primary" aria-hidden="true" />
+ <HatGlasses className="h-2/3 w-2/3 text-text-primary" aria-hidden="true" />
</div>
) : (
<ConvoIcon
diff --git a/client/src/components/Chat/Menus/HeaderMenu.tsx b/client/src/components/Chat/Menus/HeaderMenu.tsx
index 6e7b324838..f158685f70 100644
--- a/client/src/components/Chat/Menus/HeaderMenu.tsx
+++ b/client/src/components/Chat/Menus/HeaderMenu.tsx
@@ -1,9 +1,9 @@
import { useState, useId } from 'react';
import * as Ariakit from '@ariakit/react';
import { PermissionTypes, Permissions } from 'librechat-data-provider';
+import { Ellipsis, PlusCircle, HatGlasses, Check } from 'lucide-react';
import { DropdownPopup, TooltipAnchor, Button } from '@librechat/client';
import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons';
-import { Ellipsis, PlusCircle, MessageCircleDashed, Check } from 'lucide-react';
import type { TStartupConfig } from 'librechat-data-provider';
import type * as t from '~/common';
import { BookmarkContext } from '~/Providers/BookmarkContext';
@@ -100,7 +100,7 @@ export default function HeaderMenu({
icon: temporary.isTemporary ? (
<Check className="size-4 text-text-primary" />
) : (
- <MessageCircleDashed className="size-4 text-text-secondary" />
+ <HatGlasses className="size-4 text-text-secondary" />
),
onClick: temporary.toggle,
});
diff --git a/client/src/components/Chat/Subagents/SubagentThreadPanel.test.tsx b/client/src/components/Chat/Subagents/SubagentThreadPanel.test.tsx
index be2909f44b..c835da419a 100644
--- a/client/src/components/Chat/Subagents/SubagentThreadPanel.test.tsx
+++ b/client/src/components/Chat/Subagents/SubagentThreadPanel.test.tsx
@@ -70,6 +70,9 @@ jest.mock('librechat-data-provider', () => {
jest.mock('~/data-provider', () => ({
ACTIVE_THREAD_REFRESH_MS: 2000,
+ /** The panel's bottom clearance follows the conversation's configured footer
+ * (`useConfiguredFooter`), so the panel now reads the startup config. */
+ useGetStartupConfig: () => ({ data: undefined }),
useSubagentThreadQuery: (...args: unknown[]) => mockUseSubagentThreadQuery(...args),
subagentThreadHasTaskEvidence: (view: SubagentThreadView | undefined, taskId: string): boolean =>
view?.messages.some(
diff --git a/client/src/components/Chat/Subagents/SubagentThreadPanel.tsx b/client/src/components/Chat/Subagents/SubagentThreadPanel.tsx
index 7f89f9860a..c66801c2e8 100644
--- a/client/src/components/Chat/Subagents/SubagentThreadPanel.tsx
+++ b/client/src/components/Chat/Subagents/SubagentThreadPanel.tsx
@@ -48,13 +48,14 @@ import SubagentActivity, { SubagentActivityScrollSurface } from './SubagentActiv
import ApprovalProvider from '~/components/Chat/Messages/Content/ApprovalContext';
import { isMacPlatform, resolveComposerKeyDown } from '~/utils/shortcuts';
import { useFocusTrap, useLocalize, useNavigateToConvo } from '~/hooks';
+import { useConfiguredFooter } from '~/components/Chat/Footer';
import { useParentSubagents } from './ParentSubagentsProvider';
import SubagentConversation from './SubagentConversation';
import { eventSubagentSelection } from './eventSelection';
import { resolveSubagentAgentId } from './identity';
import { useAgentsMapContext } from '~/Providers';
import { isLiveSubagentStatus } from './status';
-import { renderAgentAvatar } from '~/utils';
+import { cn, renderAgentAvatar } from '~/utils';
import { useChatSurface } from './surface';
const EVENT_TASK_PAGE_SIZE = 3;
@@ -109,6 +110,9 @@ const failedControlLocaleKey = (reason?: string) => {
};
export default function SubagentThreadPanel({ selection }: { selection: ActiveSubagentPanel }) {
+ /** `present` carries the remembered answer while the config is in flight, so
+ * this surface lays out once, like the composer beside it. */
+ const clearsFooter = useConfiguredFooter().present;
const localize = useLocalize();
const panelStore = useStore();
const { showToast } = useToastContext();
@@ -1460,11 +1464,12 @@ export default function SubagentThreadPanel({ selection }: { selection: ActiveSu
{activityPanel}
</ApprovalProvider>
{(showControlFooter || composerMode != null) && (
- /* The main chat form's own bottom rhythm: its composer clears the
- viewport floor by the height of the disclaimer beneath it, and this
- one clears it by the same, so the two surfaces end on one line when
- the panel is open beside the thread. */
- <div className="shrink-0 px-3 pb-10 pt-2">
+ /* The main chat form's own bottom rhythm, read from the same answer it
+ reads (`useConfiguredFooter`): a conversation clears the footer bar
+ when the deployment configured one and otherwise keeps only enough to
+ show the composer's shadow, and this surface keeps the same, so the
+ two end on one line when the panel is open beside the thread. */
+ <div className={cn('shrink-0 px-3 pt-2', clearsFooter ? 'pb-10' : 'pb-4')}>
{transientControl?.status === 'failed' && (
<Alert variant="error" className="mb-2 flex items-center gap-2">
<span className="min-w-0 flex-1">
diff --git a/client/src/components/Chat/TemporaryChat.tsx b/client/src/components/Chat/TemporaryChat.tsx
index 1212d2472a..3c396077ef 100644
--- a/client/src/components/Chat/TemporaryChat.tsx
+++ b/client/src/components/Chat/TemporaryChat.tsx
@@ -1,4 +1,4 @@
-import { MessageCircleDashed } from 'lucide-react';
+import { HatGlasses } from 'lucide-react';
import { Chip, TooltipAnchor } from '@librechat/client';
import { useShortcutAriaKey, useShortcutHint } from '~/hooks/useKeyboardShortcuts';
import useTemporaryChat from '~/hooks/Chat/useTemporaryChat';
@@ -32,7 +32,7 @@ export function TemporaryChat() {
: 'bg-presentation shadow-sm hover:bg-surface-active-alt',
)}
>
- <MessageCircleDashed className="icon-md" aria-hidden="true" />
+ <HatGlasses className="icon-md" aria-hidden="true" />
</button>
}
/>
@@ -59,7 +59,7 @@ export function TemporaryChatIndicator() {
size="theme"
shape="theme"
className="flex-shrink-0"
- leading={<MessageCircleDashed className="size-4 shrink-0" aria-hidden="true" />}
+ leading={<HatGlasses className="size-4 shrink-0" aria-hidden="true" />}
>
<span className="max-md:sr-only">{localize('com_ui_temporary')}</span>
</Chip>
diff --git a/client/src/components/Chat/__tests__/ChatView.spec.tsx b/client/src/components/Chat/__tests__/ChatView.spec.tsx
index f35c7a513e..f97f4d7e1e 100644
--- a/client/src/components/Chat/__tests__/ChatView.spec.tsx
+++ b/client/src/components/Chat/__tests__/ChatView.spec.tsx
@@ -33,6 +33,7 @@ jest.mock('~/hooks', () => ({
useAdaptiveSSE: jest.fn(),
useResumeOnLoad: jest.fn(),
useQueueDrain: jest.fn(),
+ useScrollbarGutterSeed: jest.fn(),
}));
jest.mock('../Presentation', () => ({
@@ -40,7 +41,11 @@ jest.mock('../Presentation', () => ({
default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));
jest.mock('../Header', () => ({ __esModule: true, default: () => <div /> }));
-jest.mock('../Footer', () => ({ __esModule: true, default: () => <div /> }));
+jest.mock('../Footer', () => ({
+ __esModule: true,
+ default: () => <div />,
+ useConfiguredFooter: () => false,
+}));
jest.mock('../Landing', () => ({ __esModule: true, default: () => <div /> }));
jest.mock('../Messages/MessagesView', () => ({ __esModule: true, default: () => <div /> }));
jest.mock('../Input/ChatForm', () => ({ __esModule: true, default: () => <div /> }));
diff --git a/client/src/components/Chat/__tests__/ChatView.subagent.spec.tsx b/client/src/components/Chat/__tests__/ChatView.subagent.spec.tsx
index 8ebccc4c61..7f7a5cadfe 100644
--- a/client/src/components/Chat/__tests__/ChatView.subagent.spec.tsx
+++ b/client/src/components/Chat/__tests__/ChatView.subagent.spec.tsx
@@ -32,6 +32,7 @@ jest.mock('~/hooks', () => ({
useResumeOnLoad: jest.fn(),
useAdaptiveSSE: jest.fn(),
useQueueDrain: jest.fn(),
+ useScrollbarGutterSeed: jest.fn(),
useLocalize: () => (key: string) => key,
useChatHelpers: () => ({
conversation: mockConversation,
@@ -66,7 +67,11 @@ jest.mock('../Presentation', () => ({ children }: { children: React.ReactNode })
));
jest.mock('../Input/ChatForm', () => () => <div data-testid="chat-form" />);
jest.mock('../Landing', () => () => <div data-testid="landing" />);
-jest.mock('../Footer', () => () => <div data-testid="footer" />);
+jest.mock('../Footer', () => ({
+ __esModule: true,
+ default: () => <div data-testid="footer" />,
+ useConfiguredFooter: () => false,
+}));
jest.mock('../Header', () => ({ readOnly }: { readOnly?: boolean }) => (
<div data-read-only={String(readOnly)} data-testid="header" />
));
diff --git a/client/src/components/Chat/footerMemory.ts b/client/src/components/Chat/footerMemory.ts
new file mode 100644
index 0000000000..fca2bde075
--- /dev/null
+++ b/client/src/components/Chat/footerMemory.ts
@@ -0,0 +1,14 @@
+import { createStorageAtom } from '~/store/jotai-utils';
+
+/**
+ * Whether this deployment configured footer content of its own, as of the last
+ * time `/api/config` answered. Feature-owned and persisted: the chat surface
+ * both writes it (when the config resolves) and reads it (while the next load's
+ * config is still in flight), and a deployment's footer configuration is a
+ * deployment-lifetime fact, so remembering it is what lets the composer lay out
+ * once instead of guessing and correcting.
+ *
+ * `getOnInit` gives the stored value on the first render, which is the whole
+ * point — a value that arrived an effect later would be the guess again.
+ */
+export const configuredFooterAtom = createStorageAtom<boolean>('configured-footer', false);
diff --git a/client/src/components/Prompts/lists/List.tsx b/client/src/components/Prompts/lists/List.tsx
index 5b87b189a9..f16ba159d5 100644
--- a/client/src/components/Prompts/lists/List.tsx
+++ b/client/src/components/Prompts/lists/List.tsx
@@ -1,4 +1,5 @@
import { FileText } from 'lucide-react';
+import { EmptyState } from '@librechat/client';
import type { TPromptGroup } from 'librechat-data-provider';
import ChatGroupItem from './ChatGroupItem';
import { useLocalize } from '~/hooks';
@@ -15,17 +16,12 @@ export default function List({
const renderContent = () => {
if (groups.length === 0) {
return (
- <div className="my-2 flex flex-col items-center justify-center rounded-lg border border-border-medium bg-transparent p-6 text-center">
- <div className="mb-2 flex size-10 items-center justify-center rounded-full bg-surface-tertiary">
- <FileText className="size-5 text-text-secondary" aria-hidden="true" />
- </div>
- <p className="text-sm font-medium text-text-primary">
- {localize('com_ui_no_prompts_title')}
- </p>
- <p className="mt-0.5 text-xs text-text-secondary">
- {localize('com_ui_add_first_prompt')}
- </p>
- </div>
+ <EmptyState
+ icon={FileText}
+ title={localize('com_ui_no_prompts_title')}
+ description={localize('com_ui_add_first_prompt')}
+ className="my-2"
+ />
);
}
diff --git a/client/src/hooks/Messages/index.ts b/client/src/hooks/Messages/index.ts
index 53e7dc0bfe..7ec352d294 100644
--- a/client/src/hooks/Messages/index.ts
+++ b/client/src/hooks/Messages/index.ts
@@ -28,5 +28,5 @@ export { default as useCopyToClipboard } from './useCopyToClipboard';
export { hasCopyableText, useCopyMessageToClipboard } from './useCopyToClipboard';
export { default as useContentMetadata } from './useContentMetadata';
export { default as useMessageScrolling } from './useMessageScrolling';
-export { default as useScrollbarGutter } from './useScrollbarGutter';
+export { default as useScrollbarGutter, useScrollbarGutterSeed } from './useScrollbarGutter';
export { default as useSmoothStreaming } from './useSmoothStreaming';
diff --git a/client/src/hooks/Messages/useScrollbarGutter.ts b/client/src/hooks/Messages/useScrollbarGutter.ts
index d8a25060ff..06d35adf8f 100644
--- a/client/src/hooks/Messages/useScrollbarGutter.ts
+++ b/client/src/hooks/Messages/useScrollbarGutter.ts
@@ -1,4 +1,4 @@
-import { useEffect } from 'react';
+import { useEffect, useLayoutEffect } from 'react';
export const SCROLLBAR_GUTTER_PROPERTY = '--message-scrollbar-gutter';
@@ -39,3 +39,66 @@ export default function useScrollbarGutter(
return () => observer.disconnect();
}, [scrollableRef]);
}
+
+/** Publishes the same band before any message column has mounted. The welcome
+ * screen holds it back too — it centres greeting and composer against where the
+ * message column will be — and on a fresh load nothing has measured it, so the
+ * spacer would fall back to the `--scrollbar-size` token: a fixed 8px, right
+ * only where the app's own `::-webkit-scrollbar` width applies and wrong on
+ * every overlay-scrollbar platform, which reserves nothing.
+ *
+ * A detached probe built like the column — `overflow-y: auto` with
+ * `scrollbar-gutter: stable` — answers the same question the column does, and
+ * answers it for the platform in front of the user. A mounted column measures
+ * itself and is authoritative, so this only fills the gap before the first one
+ * exists and never overwrites a published measurement.
+ *
+ * It measures in a layout effect, before the browser paints: a passive effect
+ * would let the first frame reserve the token's 8px and then recentre the
+ * welcome screen by 4px once the real band is known, which is the same visible
+ * shift this reservation exists to remove.
+ *
+ * The band is not a constant of the platform either: the contrast modes widen
+ * the app's own scrollbar (`--scrollbar-size` goes to 0.75rem under
+ * `html.high-contrast`), and a reader can turn contrast on — or have the OS
+ * turn it on — while the welcome screen is the only thing mounted, with no
+ * message column to republish. `ThemeProvider` carries every contrast and
+ * scheme decision as a class on the document element, so remeasuring on that
+ * is remeasuring on the thing that changed the band. */
+export function useScrollbarGutterSeed(): void {
+ useLayoutEffect(() => {
+ const root = document.documentElement;
+
+ const measure = () => {
+ const probe = document.createElement('div');
+ probe.style.position = 'absolute';
+ probe.style.top = '-9999px';
+ probe.style.width = '100px';
+ probe.style.height = '100px';
+ probe.style.overflowY = 'auto';
+ probe.style.scrollbarGutter = 'stable';
+ probe.style.visibility = 'hidden';
+ document.body.appendChild(probe);
+ const gutter = Math.max(0, probe.offsetWidth - probe.clientWidth);
+ probe.remove();
+ root.style.setProperty(SCROLLBAR_GUTTER_PROPERTY, `${gutter}px`);
+ };
+
+ /** Measure on every mount, never trusting what is already there: the value
+ * outlives this screen on purpose, and the screens it outlives — the auth
+ * layout among them — carry a theme selector that can change the band while
+ * nothing is watching. */
+ measure();
+
+ if (typeof MutationObserver === 'undefined') {
+ return;
+ }
+
+ /** A mounted column observes its own box and republishes on the same flip,
+ * so the two agree; this is what covers the screens that have no column. */
+ const observer = new MutationObserver(measure);
+ observer.observe(root, { attributes: true, attributeFilter: ['class', 'data-theme'] });
+
+ return () => observer.disconnect();
+ }, []);
+}
diff --git a/client/src/hooks/useChatBadges.ts b/client/src/hooks/useChatBadges.ts
index abc23ee300..3b8d4721d9 100644
--- a/client/src/hooks/useChatBadges.ts
+++ b/client/src/hooks/useChatBadges.ts
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
-import { useRecoilCallback } from 'recoil';
+import { Box } from 'lucide-react';
import { useRecoilValue } from 'recoil';
-import { MessageCircleDashed, Box } from 'lucide-react';
+import { useRecoilCallback } from 'recoil';
import type { BadgeItem } from '~/common';
import { useLocalize, TranslationKeys } from '~/hooks';
import store from '~/store';
diff --git a/client/src/mobile.css b/client/src/mobile.css
index f872c03a6a..69b9d7b07e 100644
--- a/client/src/mobile.css
+++ b/client/src/mobile.css
@@ -91,8 +91,14 @@
publishes it here. The token is only the fallback for before that first
measurement: it matches the `::-webkit-scrollbar` width, which Firefox
ignores and an overlay scrollbar drops to nothing. */
-.scrollbar-gutter-spacer {
- padding-inline-end: var(--message-scrollbar-gutter, var(--scrollbar-size));
+/* Below `sm` the composer runs edge to edge (it is squared off at the bottom and
+ carries no horizontal padding there), so holding the band back would leave a
+ dead strip down its right side instead of lining anything up. The message
+ column it aligns to only shares a centre from `sm` up. */
+@media (min-width: 640px) {
+ .scrollbar-gutter-spacer {
+ padding-inline-end: var(--message-scrollbar-gutter, var(--scrollbar-size));
+ }
}
/* Base wrapper for both preview and editor */
diff --git a/e2e/specs/mock/scenarios/cold-load-clearance.spec.ts b/e2e/specs/mock/scenarios/cold-load-clearance.spec.ts
new file mode 100644
index 0000000000..23d8e08727
--- /dev/null
+++ b/e2e/specs/mock/scenarios/cold-load-clearance.spec.ts
@@ -0,0 +1,153 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import { deleteConversations, deleteMessagesByConversation, seedConversations } from '../db';
+
+/**
+ * Whether a conversation carries a footer is an answer from the startup config,
+ * and on a cold load of `/c/<id>` that answer arrives after the composer has
+ * already been painted. Guessing "no footer" until then moves the composer twice
+ * — down to the bare clearance, then back up when the footer appears.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+const CUSTOM_FOOTER = 'Operator policy footer';
+const CONVERSATION_TITLE = 'Cold load clearance';
+
+declare global {
+ interface Window {
+ /** Every composer bottom painted since the document started. */
+ __composerBottomSamples?: number[];
+ }
+}
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+/** A configured footer whose answer is deliberately slow, plus a sampler that
+ * runs from the document's first frame. Both are in place before the app's own
+ * scripts, so nothing about the app's own timing is assumed. */
+async function serveSlowConfiguredFooter(page: Page) {
+ await page.route('**/api/config', async (route) => {
+ const response = await route.fetch();
+ const config = await response.json();
+ const delayed = Promise.withResolvers<void>();
+ setTimeout(() => delayed.resolve(), 700);
+ await delayed.promise;
+ await route.fulfill({ response, json: { ...config, customFooter: CUSTOM_FOOTER } });
+ });
+ await installSampler(page);
+}
+
+/** A sampler that records the composer's bottom from the document's first frame,
+ * served with the HTML so it is in place before the app's own scripts. */
+async function installSampler(page: Page) {
+ await page.route('**/*', async (route) => {
+ if (route.request().resourceType() !== 'document') {
+ return route.fallback();
+ }
+ const response = await route.fetch();
+ const sampler = `<script>
+ window.__composerBottomSamples = [];
+ (function sample() {
+ var node = document.querySelector('[data-testid="composer-surface"]');
+ if (node) {
+ var bottom = Math.round(node.getBoundingClientRect().bottom * 100) / 100;
+ var samples = window.__composerBottomSamples;
+ if (samples.length === 0 || samples[samples.length - 1] !== bottom) {
+ samples.push(bottom);
+ }
+ }
+ if (window.__composerBottomSamples.length < 200) {
+ requestAnimationFrame(sample);
+ }
+ })();
+</script>`;
+ const body = (await response.text()).replace('<head>', `<head>${sampler}`);
+ await route.fulfill({ response, body });
+ });
+}
+
+test.describe('cold load clearance', () => {
+ test('the composer does not jump when the configured footer arrives @scenario:configured-footer-clearance-survives-a-cold-load', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ const conversationId = randomUUID();
+ await seedConversations(getE2EUser().email, [
+ { conversationId, title: CONVERSATION_TITLE, updatedAt: new Date() },
+ ]);
+
+ try {
+ await serveSlowConfiguredFooter(page);
+ /** The first visit is what records the deployment's answer; the load under
+ * test is every one after it, where the composer must lay out once. */
+ await page.goto(`/c/${conversationId}`, { timeout: 15000 });
+ await expect(page.getByText(CUSTOM_FOOTER)).toBeVisible({ timeout: 15000 });
+ await page.goto(`/c/${conversationId}`, { timeout: 15000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ /** Past the delayed config answer and any correction it would cause. */
+ await expect(page.getByText(CUSTOM_FOOTER)).toBeVisible({ timeout: 15000 });
+ await page.waitForTimeout(800);
+
+ const samples = await page.evaluate(() => window.__composerBottomSamples ?? []);
+ expect(samples.length).toBeGreaterThan(0);
+ const settled = samples[samples.length - 1];
+ const drift = Math.max(...samples.map((bottom) => Math.abs(bottom - settled)));
+ expect(
+ drift,
+ `the composer moved when the configured footer arrived: ${JSON.stringify(samples)}`,
+ ).toBeLessThanOrEqual(0.5);
+ } finally {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+});
+
+/** A deployment that configures nothing is the common one, and its cold load has
+ * the same right to lay out once: reserving the band "just in case" and dropping
+ * it when the config answers moves the composer 24px down. */
+async function serveSlowDefaultConfig(page: Page) {
+ await page.route('**/api/config', async (route) => {
+ const response = await route.fetch();
+ const config = await response.json();
+ const delayed = Promise.withResolvers<void>();
+ setTimeout(() => delayed.resolve(), 700);
+ await delayed.promise;
+ await route.fulfill({ response, json: { ...config, customFooter: undefined } });
+ });
+ await installSampler(page);
+}
+
+test.describe('cold load clearance without a footer', () => {
+ test('the composer does not jump when the config confirms no footer @scenario:default-clearance-survives-a-cold-load', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ const conversationId = randomUUID();
+ await seedConversations(getE2EUser().email, [
+ { conversationId, title: 'Default clearance', updatedAt: new Date() },
+ ]);
+
+ try {
+ await serveSlowDefaultConfig(page);
+ await page.goto(`/c/${conversationId}`, { timeout: 15000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ /** Past the delayed answer and any correction it would cause. */
+ await page.waitForTimeout(1800);
+
+ const samples = await page.evaluate(() => window.__composerBottomSamples ?? []);
+ expect(samples.length).toBeGreaterThan(0);
+ const settled = samples[samples.length - 1];
+ const drift = Math.max(...samples.map((bottom) => Math.abs(bottom - settled)));
+ expect(
+ drift,
+ `the composer moved when the config answered: ${JSON.stringify(samples)}`,
+ ).toBeLessThanOrEqual(0.5);
+ } finally {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/composer-position.spec.ts b/e2e/specs/mock/scenarios/composer-position.spec.ts
new file mode 100644
index 0000000000..35d9c80f76
--- /dev/null
+++ b/e2e/specs/mock/scenarios/composer-position.spec.ts
@@ -0,0 +1,282 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import {
+ deleteConversations,
+ deleteMessagesByConversation,
+ seedConversations,
+ seedMessages,
+} from '../db';
+
+/**
+ * Opening a conversation from the welcome screen moves the composer down by the
+ * disclaimer's clearance and must not move it sideways at all. The sideways
+ * offset came from the scrollbar band the message column holds back: the
+ * conversation reserved it and the welcome screen did not, so the composer
+ * stepped 4px left on the way in. Where scrollbars overlay, the band is zero and
+ * nothing may be reserved on either side of the navigation.
+ *
+ * The composer is full-bleed below `sm` with no clearance to travel, so these
+ * run on the desktop projects.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+const CONVERSATION_TITLE = 'Composer position';
+
+type Box = { left: number; right: number; width: number; centre: number };
+
+const skipBelowSm = (page: Page) => {
+ const width = page.viewportSize()?.width ?? 0;
+ test.skip(width < 640, 'the composer is full-bleed below the sm breakpoint');
+};
+
+async function seedThread() {
+ const conversationId = randomUUID();
+ const { email } = getE2EUser();
+ await seedConversations(email, [
+ { conversationId, title: CONVERSATION_TITLE, updatedAt: new Date() },
+ ]);
+ const userMessageId = randomUUID();
+ await seedMessages(email, conversationId, [
+ {
+ messageId: userMessageId,
+ parentMessageId: '00000000-0000-0000-0000-000000000000',
+ text: 'Where does the composer sit?',
+ isCreatedByUser: true,
+ sender: 'User',
+ },
+ {
+ messageId: randomUUID(),
+ parentMessageId: userMessageId,
+ text: 'Exactly where it sat on the welcome screen.',
+ isCreatedByUser: false,
+ sender: 'Mock Provider A',
+ },
+ ]);
+ return conversationId;
+}
+
+async function dropThread(conversationId: string) {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+}
+
+const boxOf = (page: Page, selector: string): Promise<Box> =>
+ page.evaluate((target) => {
+ const node = document.querySelector(target);
+ if (!node) {
+ throw new Error(`${target} is not rendered`);
+ }
+ const rect = node.getBoundingClientRect();
+ return {
+ left: Math.round(rect.left * 100) / 100,
+ right: Math.round(rect.right * 100) / 100,
+ width: Math.round(rect.width * 100) / 100,
+ centre: Math.round((rect.left + rect.width / 2) * 100) / 100,
+ };
+ }, selector);
+
+/** Navigate the way a user does — the sidebar row — so the app keeps the composer
+ * node it already rendered instead of mounting a new one. */
+async function openSeededConversation(page: Page) {
+ const row = page.getByTestId('convo-item').filter({ hasText: CONVERSATION_TITLE }).first();
+ await expect(row).toBeVisible({ timeout: 20000 });
+ await row.click();
+ await expect(page.locator('.message-render').first()).toBeVisible({ timeout: 20000 });
+}
+
+async function settleComposer(page: Page) {
+ /** The clearance transitions for 300ms; wait for the box to stop moving. */
+ let previous = await boxOf(page, COMPOSER);
+ for (let attempt = 0; attempt < 20; attempt++) {
+ await page.waitForTimeout(200);
+ const next = await boxOf(page, COMPOSER);
+ if (Math.abs(next.left - previous.left) < 0.5 && Math.abs(next.width - previous.width) < 0.5) {
+ return next;
+ }
+ previous = next;
+ }
+ throw new Error(`the composer never settled: ${JSON.stringify(previous)}`);
+}
+
+declare global {
+ interface Window {
+ /** Filled by the in-page sampler below; read back after the navigation. */
+ __composerTransitions?: string[];
+ }
+}
+
+/** Records every CSS transition the composer's own form runs, for the whole
+ * window, so a navigation that jumps records nothing. */
+async function watchComposerTransitions(page: Page) {
+ await page.evaluate((selector) => {
+ const form = document.querySelector(selector)?.closest('form');
+ if (!form) {
+ throw new Error('the composer form is not rendered');
+ }
+ const seen: string[] = [];
+ window.__composerTransitions = seen;
+ const started = performance.now();
+ const sample = () => {
+ for (const animation of form.getAnimations()) {
+ if (animation instanceof CSSTransition && !seen.includes(animation.transitionProperty)) {
+ seen.push(animation.transitionProperty);
+ }
+ }
+ if (performance.now() - started < 3000) {
+ requestAnimationFrame(sample);
+ }
+ };
+ requestAnimationFrame(sample);
+ }, COMPOSER);
+}
+
+/** A platform whose scrollbars reserve nothing — macOS and iOS by default.
+ * The rule has to be in the document's own stylesheet before the app's scripts
+ * run, so it is served with the HTML rather than injected afterwards: a style
+ * appended from an init script can land after React has already measured. */
+async function serveWithOverlayScrollbars(page: Page) {
+ await page.route('**/*', async (route) => {
+ if (route.request().resourceType() !== 'document') {
+ return route.fallback();
+ }
+ const response = await route.fetch();
+ const body = (await response.text()).replace(
+ '<head>',
+ '<head><style>::-webkit-scrollbar { width: 0 !important; height: 0 !important; } * { scrollbar-width: none !important; }</style>',
+ );
+ await route.fulfill({ response, body });
+ });
+}
+
+/** The band the message column actually holds back, as the app measures it. */
+const measuredGutter = (page: Page): Promise<number> =>
+ page.evaluate(() => {
+ const column = document.querySelector('.scrollbar-gutter-stable');
+ if (!column) {
+ throw new Error('the message column is not rendered');
+ }
+ return Math.max(0, column.getBoundingClientRect().width - column.clientWidth);
+ });
+
+const recordedTransitions = (page: Page): Promise<string[]> =>
+ page.evaluate(() => window.__composerTransitions ?? []);
+
+test.describe('composer position across the welcome screen', () => {
+ test('the composer keeps its horizontal position and width into a conversation @scenario:composer-holds-position-into-conversation', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ skipBelowSm(page);
+ const conversationId = await seedThread();
+
+ try {
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ const onWelcome = await settleComposer(page);
+
+ await openSeededConversation(page);
+ const inConversation = await settleComposer(page);
+
+ expect(inConversation.left).toBeCloseTo(onWelcome.left, 0);
+ expect(inConversation.width).toBeCloseTo(onWelcome.width, 0);
+
+ /** The conversation composer is the anchored one: it lines up with the
+ * message column, which is what the welcome screen now matches. */
+ const messageRow = await boxOf(page, '.message-render');
+ expect(Math.abs(inConversation.centre - messageRow.centre)).toBeLessThanOrEqual(1);
+ } finally {
+ await dropThread(conversationId);
+ }
+ });
+
+ test('the composer keeps its position where scrollbars overlay @scenario:composer-holds-position-with-overlay-scrollbars', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ skipBelowSm(page);
+ const conversationId = await seedThread();
+
+ try {
+ await serveWithOverlayScrollbars(page);
+
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ const onWelcome = await settleComposer(page);
+
+ await openSeededConversation(page);
+ const inConversation = await settleComposer(page);
+
+ /** The emulation is the whole point of this scenario: if the platform still
+ * reserves a band, the run proves nothing and has to say so. */
+ expect(await measuredGutter(page)).toBe(0);
+
+ expect(inConversation.left).toBeCloseTo(onWelcome.left, 0);
+ expect(inConversation.width).toBeCloseTo(onWelcome.width, 0);
+
+ const messageRow = await boxOf(page, '.message-render');
+ expect(Math.abs(inConversation.centre - messageRow.centre)).toBeLessThanOrEqual(1);
+ } finally {
+ await dropThread(conversationId);
+ }
+ });
+
+ test('the composer slides down when a conversation opens @scenario:composer-slides-down-into-conversation', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ skipBelowSm(page);
+ const conversationId = await seedThread();
+
+ try {
+ /** The reported case: the welcome composer already sits at the bottom, so
+ * the clearance change is the whole movement. */
+ await page.addInitScript(() => {
+ window.localStorage.setItem('centerFormOnLanding', 'false');
+ });
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ const onWelcome = await settleComposer(page);
+
+ await watchComposerTransitions(page);
+ await openSeededConversation(page);
+ const inConversation = await settleComposer(page);
+
+ expect(inConversation.left).toBeCloseTo(onWelcome.left, 0);
+ expect(await recordedTransitions(page)).toContain('margin-bottom');
+ } finally {
+ await dropThread(conversationId);
+ }
+ });
+
+ test('the composer settles without motion when the reader asked for less @scenario:composer-settles-instantly-under-reduced-motion', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ skipBelowSm(page);
+ const conversationId = await seedThread();
+
+ try {
+ await page.emulateMedia({ reducedMotion: 'reduce' });
+ await page.addInitScript(() => {
+ window.localStorage.setItem('centerFormOnLanding', 'false');
+ });
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ const onWelcome = await settleComposer(page);
+
+ await watchComposerTransitions(page);
+ await openSeededConversation(page);
+ const inConversation = await settleComposer(page);
+
+ expect(await recordedTransitions(page)).toEqual([]);
+ /** No motion is not no move: the conversation clearance still applies. */
+ expect(inConversation.right).toBeGreaterThan(0);
+ expect(inConversation.left).toBeCloseTo(onWelcome.left, 0);
+ } finally {
+ await page.emulateMedia({ reducedMotion: null });
+ await dropThread(conversationId);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/configured-footer-clearance.spec.ts b/e2e/specs/mock/scenarios/configured-footer-clearance.spec.ts
new file mode 100644
index 0000000000..1ee0f6b205
--- /dev/null
+++ b/e2e/specs/mock/scenarios/configured-footer-clearance.spec.ts
@@ -0,0 +1,68 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import { deleteConversations, deleteMessagesByConversation, seedConversations } from '../db';
+
+/**
+ * The footer is an absolutely positioned bar in a zero-height wrapper, so the
+ * composer above it is what reserves its band. A conversation that keeps a
+ * deployment's configured footer therefore has to keep that clearance too, or
+ * the bar paints over the composer's action row and takes the clicks meant for
+ * it.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+const CUSTOM_FOOTER = 'Operator policy footer';
+const CONVERSATION_TITLE = 'Configured footer clearance';
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+async function withConfiguredFooter(page: Page) {
+ await page.route('**/api/config', async (route) => {
+ const response = await route.fetch();
+ const config = await response.json();
+ await route.fulfill({ response, json: { ...config, customFooter: CUSTOM_FOOTER } });
+ });
+}
+
+test.describe('configured footer clearance', () => {
+ test('a configured footer never covers the composer @scenario:configured-footer-clears-the-composer', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ const conversationId = randomUUID();
+ await seedConversations(getE2EUser().email, [
+ { conversationId, title: CONVERSATION_TITLE, updatedAt: new Date() },
+ ]);
+
+ try {
+ await withConfiguredFooter(page);
+ await page.goto(`/c/${conversationId}`, { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ const footer = page.getByText(CUSTOM_FOOTER);
+ await expect(footer).toBeVisible();
+
+ const composerBox = await page.locator(COMPOSER).boundingBox();
+ const footerBox = await footer.boundingBox();
+ expect(composerBox).not.toBeNull();
+ expect(footerBox).not.toBeNull();
+ const composerBottom = (composerBox?.y ?? 0) + (composerBox?.height ?? 0);
+ expect(
+ footerBox?.y ?? 0,
+ 'the configured footer overlaps the composer',
+ ).toBeGreaterThanOrEqual(composerBottom);
+
+ /** Overlap is not only visual: the bar would take the composer's clicks. */
+ const input = page.getByRole('textbox', { name: 'Message input' });
+ await page
+ .locator(COMPOSER)
+ .click({ position: { x: 40, y: (composerBox?.height ?? 40) - 8 } });
+ await input.fill('still reachable');
+ await expect(input).toHaveValue('still reachable');
+ } finally {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/configured-footer.spec.ts b/e2e/specs/mock/scenarios/configured-footer.spec.ts
new file mode 100644
index 0000000000..da6c409ced
--- /dev/null
+++ b/e2e/specs/mock/scenarios/configured-footer.spec.ts
@@ -0,0 +1,62 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import { deleteConversations, deleteMessagesByConversation, seedConversations } from '../db';
+
+/**
+ * The generic model disclaimer belongs to the welcome screen. A deployment's own
+ * footer is different content: an operator who sets `customFooter` puts policy or
+ * branding there, and the authenticated chat is where it is read. Scoping the
+ * disclaimer to the welcome screen must not take that configuration off the
+ * conversation screen with it.
+ *
+ * The footer is hidden below `sm`, so this runs on the desktop viewport it
+ * describes.
+ */
+
+const CUSTOM_FOOTER = 'Operator policy footer';
+const CONVERSATION_TITLE = 'Configured footer';
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+/** Serve the deployment's startup config with a custom footer configured,
+ * without changing the shared harness config every other spec reads. */
+async function withConfiguredFooter(page: Page) {
+ await page.route('**/api/config', async (route) => {
+ const response = await route.fetch();
+ const config = await response.json();
+ await route.fulfill({
+ response,
+ json: { ...config, customFooter: CUSTOM_FOOTER },
+ });
+ });
+}
+
+test.describe('configured footer', () => {
+ test("an operator's footer stays in the conversation @scenario:configured-footer-stays-in-a-conversation", async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ const conversationId = randomUUID();
+ await seedConversations(getE2EUser().email, [
+ { conversationId, title: CONVERSATION_TITLE, updatedAt: new Date() },
+ ]);
+
+ try {
+ await withConfiguredFooter(page);
+
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.getByText(CUSTOM_FOOTER)).toBeVisible();
+ /** The generic disclaimer is replaced by the operator's content, as before. */
+ await expect(page.locator('a[href="https://librechat.ai"]')).toHaveCount(0);
+
+ await page.goto(`/c/${conversationId}`, { timeout: 10000 });
+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible();
+ await expect(page.getByText(CUSTOM_FOOTER)).toBeVisible();
+ } finally {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/contrast-switch-position.spec.ts b/e2e/specs/mock/scenarios/contrast-switch-position.spec.ts
new file mode 100644
index 0000000000..1952b2ec4e
--- /dev/null
+++ b/e2e/specs/mock/scenarios/contrast-switch-position.spec.ts
@@ -0,0 +1,105 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import {
+ deleteConversations,
+ deleteMessagesByConversation,
+ seedConversations,
+ seedMessages,
+} from '../db';
+
+/**
+ * The band the message column reserves is not a constant of the platform: the
+ * contrast modes widen the app's own scrollbar. A reader who turns contrast on
+ * while the welcome screen is the only thing mounted has no message column to
+ * republish that width, so the welcome screen must remeasure it itself — or the
+ * first conversation corrects it and the composer steps sideways.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+const CONVERSATION_TITLE = 'Contrast switch';
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+type Box = { left: number; width: number };
+
+const boxOf = (page: Page): Promise<Box> =>
+ page.evaluate((selector) => {
+ const node = document.querySelector(selector);
+ if (!node) {
+ throw new Error(`${selector} is not rendered`);
+ }
+ const rect = node.getBoundingClientRect();
+ return {
+ left: Math.round(rect.left * 100) / 100,
+ width: Math.round(rect.width * 100) / 100,
+ };
+ }, COMPOSER);
+
+async function settle(page: Page): Promise<Box> {
+ let previous = await boxOf(page);
+ for (let attempt = 0; attempt < 20; attempt++) {
+ await page.waitForTimeout(200);
+ const next = await boxOf(page);
+ if (Math.abs(next.left - previous.left) < 0.5 && Math.abs(next.width - previous.width) < 0.5) {
+ return next;
+ }
+ previous = next;
+ }
+ throw new Error(`the composer never settled: ${JSON.stringify(previous)}`);
+}
+
+test.describe('contrast switch', () => {
+ test('the composer holds its position across a contrast switch @scenario:composer-holds-position-across-a-contrast-switch', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ const conversationId = randomUUID();
+ const { email } = getE2EUser();
+ await seedConversations(email, [
+ { conversationId, title: CONVERSATION_TITLE, updatedAt: new Date() },
+ ]);
+ const userMessageId = randomUUID();
+ await seedMessages(email, conversationId, [
+ {
+ messageId: userMessageId,
+ parentMessageId: '00000000-0000-0000-0000-000000000000',
+ text: 'Does contrast move the composer?',
+ isCreatedByUser: true,
+ sender: 'User',
+ },
+ {
+ messageId: randomUUID(),
+ parentMessageId: userMessageId,
+ text: 'It should not.',
+ isCreatedByUser: false,
+ sender: 'Mock Provider A',
+ },
+ ]);
+
+ try {
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ await settle(page);
+
+ /** The OS contrast preference, changed while the welcome screen is up. */
+ await page.emulateMedia({ contrast: 'more' });
+ await expect(page.locator('html.high-contrast')).toHaveCount(1, { timeout: 10000 });
+ const onWelcome = await settle(page);
+
+ const row = page.getByTestId('convo-item').filter({ hasText: CONVERSATION_TITLE }).first();
+ await expect(row).toBeVisible({ timeout: 20000 });
+ await row.click();
+ await expect(page.locator('.message-render').first()).toBeVisible({ timeout: 20000 });
+ const inConversation = await settle(page);
+
+ expect(inConversation.left).toBeCloseTo(onWelcome.left, 0);
+ expect(inConversation.width).toBeCloseTo(onWelcome.width, 0);
+ } finally {
+ await page.emulateMedia({ contrast: null });
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/empty-prompts-panel.spec.ts b/e2e/specs/mock/scenarios/empty-prompts-panel.spec.ts
new file mode 100644
index 0000000000..90013dfb67
--- /dev/null
+++ b/e2e/specs/mock/scenarios/empty-prompts-panel.spec.ts
@@ -0,0 +1,60 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+
+/**
+ * The panels share one empty card: a bordered box with a circular icon, a title
+ * and a line of explanation. The prompts panel drew its own copy of it, a shade
+ * off on the border, so an empty prompts list did not look like an empty
+ * bookmarks or memories list.
+ */
+
+type CardStyle = {
+ borderColor: string;
+ borderWidth: string;
+ borderRadius: string;
+ padding: string;
+ textAlign: string;
+ iconBackground: string;
+};
+
+test.describe('empty panel cards', () => {
+ test('the empty prompts panel is drawn like the other panels @scenario:empty-prompts-panel-matches-other-panels', async ({
+ page,
+ }) => {
+ const width = page.viewportSize()?.width ?? 0;
+ test.skip(width < 768, 'the side panels open as a drawer below md');
+
+ await page.goto('/c/new', { timeout: 10000 });
+
+ const prompts = await openPanelCard(page, 'Prompts', 'No prompts yet');
+ const bookmarks = await openPanelCard(page, 'Bookmarks', 'No bookmarks yet');
+
+ expect(prompts).toEqual(bookmarks);
+ });
+});
+
+/** Open a side panel from the rail and measure the empty card it renders. */
+async function openPanelCard(page: Page, panel: string, title: string): Promise<CardStyle> {
+ await page.getByRole('button', { name: panel }).first().click();
+ await expect(page.getByText(title, { exact: true }).first()).toBeVisible({ timeout: 20000 });
+
+ return page.evaluate((heading) => {
+ const label = Array.from(document.querySelectorAll('p')).find(
+ (node) => node.textContent?.trim() === heading,
+ );
+ const card = label?.parentElement;
+ const icon = card?.firstElementChild;
+ if (!card || !icon) {
+ throw new Error(`the ${heading} card is not rendered`);
+ }
+ const style = getComputedStyle(card);
+ return {
+ borderColor: style.borderColor,
+ borderWidth: style.borderWidth,
+ borderRadius: style.borderRadius,
+ padding: style.padding,
+ textAlign: style.textAlign,
+ iconBackground: getComputedStyle(icon).backgroundColor,
+ };
+ }, title);
+}
diff --git a/e2e/specs/mock/scenarios/mobile-composer-edges.spec.ts b/e2e/specs/mock/scenarios/mobile-composer-edges.spec.ts
new file mode 100644
index 0000000000..c68e892b6c
--- /dev/null
+++ b/e2e/specs/mock/scenarios/mobile-composer-edges.spec.ts
@@ -0,0 +1,57 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+
+/**
+ * Below `sm` the composer is full-bleed: squared off at the bottom and flush
+ * with the screen. It was inset on two sides anyway — it reserved the message
+ * column's scrollbar band on its trailing edge, and carried a band of padding
+ * under its action row — so the surface stopped short of both edges.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+/** The spec declares the viewport it describes rather than depending on a
+ * runner's project matrix: the repository's own mock config has a single
+ * Desktop Chrome project, where a width-gated mobile assertion would skip and
+ * report nothing. */
+test.use({ viewport: { width: 390, height: 844 } });
+
+test.describe('mobile composer', () => {
+ test('the composer reaches the screen edges @scenario:mobile-composer-reaches-screen-edges', async ({
+ page,
+ }) => {
+ const width = page.viewportSize()?.width ?? 0;
+ expect(width).toBeLessThan(640);
+
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+
+ const edges = await measureEdges(page);
+ expect(edges.left).toBeCloseTo(0, 0);
+ expect(edges.right).toBeCloseTo(edges.viewportWidth, 0);
+ /** The action row is the last thing in the surface: no empty band under it. */
+ expect(edges.surfaceBottom - edges.actionRowBottom).toBeLessThanOrEqual(2);
+ expect(edges.viewportHeight - edges.surfaceBottom).toBeLessThanOrEqual(2);
+ });
+});
+
+async function measureEdges(page: Page) {
+ return page.evaluate((selector) => {
+ const surface = document.querySelector(selector);
+ if (!surface) {
+ throw new Error(`${selector} is not rendered`);
+ }
+ const actionRow = surface.lastElementChild;
+ if (!actionRow) {
+ throw new Error('the composer surface has no action row');
+ }
+ const surfaceRect = surface.getBoundingClientRect();
+ return {
+ left: Math.round(surfaceRect.left),
+ right: Math.round(surfaceRect.right),
+ surfaceBottom: Math.round(surfaceRect.bottom),
+ actionRowBottom: Math.round(actionRow.getBoundingClientRect().bottom),
+ viewportWidth: window.innerWidth,
+ viewportHeight: window.innerHeight,
+ };
+ }, COMPOSER);
+}
diff --git a/e2e/specs/mock/scenarios/stale-gutter.spec.ts b/e2e/specs/mock/scenarios/stale-gutter.spec.ts
new file mode 100644
index 0000000000..8db585370a
--- /dev/null
+++ b/e2e/specs/mock/scenarios/stale-gutter.spec.ts
@@ -0,0 +1,63 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+
+/**
+ * The measured band outlives the chat screen on purpose — a second chat column
+ * reads it rather than remeasuring — and the screens it outlives can change it:
+ * the auth layout carries a theme selector, and a contrast switch there widens
+ * the app's own scrollbar while nothing is watching. So the chat screen has to
+ * remeasure on arrival rather than trust what it finds.
+ */
+
+const COMPOSER = '[data-testid="composer-surface"]';
+/** Nothing the platform would ever reserve; only a stale value looks like this. */
+const STALE_GUTTER = '40px';
+
+test.use({ viewport: { width: 1280, height: 800 } });
+
+/** Leave a stale reservation behind, the way another screen would have. */
+async function withStaleGutter(page: Page) {
+ await page.addInitScript((value) => {
+ const apply = () => {
+ document.documentElement.style.setProperty('--message-scrollbar-gutter', value);
+ };
+ if (document.documentElement) {
+ apply();
+ }
+ document.addEventListener('readystatechange', apply, { once: true });
+ }, STALE_GUTTER);
+}
+
+const measured = (page: Page) =>
+ page.evaluate(() => {
+ const surface = document.querySelector('[data-testid="composer-surface"]');
+ const column = surface?.closest('form')?.parentElement;
+ if (!surface || !column) {
+ throw new Error('the composer column is not rendered');
+ }
+ return {
+ published: getComputedStyle(document.documentElement)
+ .getPropertyValue('--message-scrollbar-gutter')
+ .trim(),
+ composerRight: Math.round(surface.getBoundingClientRect().right),
+ columnRight: Math.round(column.getBoundingClientRect().right),
+ };
+ });
+
+test.describe('stale gutter', () => {
+ test('the welcome screen remeasures a band it did not measure @scenario:welcome-screen-remeasures-a-stale-gutter', async ({
+ page,
+ }) => {
+ test.setTimeout(60000);
+ await withStaleGutter(page);
+
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(COMPOSER)).toBeVisible();
+ await page.waitForTimeout(600);
+
+ const state = await measured(page);
+ expect(state.published, 'the stale reservation was kept').not.toBe(STALE_GUTTER);
+ /** 40px of phantom scrollbar would push the composer that far off its column. */
+ expect(state.columnRight - state.composerRight).toBeLessThanOrEqual(16);
+ });
+});
diff --git a/e2e/specs/mock/scenarios/temporary-chat-icon.spec.ts b/e2e/specs/mock/scenarios/temporary-chat-icon.spec.ts
new file mode 100644
index 0000000000..656bcf3732
--- /dev/null
+++ b/e2e/specs/mock/scenarios/temporary-chat-icon.spec.ts
@@ -0,0 +1,54 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+
+/**
+ * Temporary chat is a retention mode, and it was marked with a dashed speech
+ * bubble that reads as a generic chat glyph. It now carries lucide's
+ * hat-and-glasses incognito mark, on the toggle that turns it on and on the
+ * welcome screen that explains it.
+ */
+
+const INCOGNITO = 'svg.lucide-hat-glasses';
+const TOGGLE = 'button[aria-label="Temporary Chat"]';
+
+test.describe('temporary chat mark', () => {
+ test('turning temporary chat on marks it with the incognito icon @scenario:temporary-chat-marked-with-incognito-icon', async ({
+ page,
+ }) => {
+ const width = page.viewportSize()?.width ?? 0;
+ test.skip(width < 768, 'the header toggle collapses into the overflow menu below md');
+
+ await page.goto('/c/new', { timeout: 10000 });
+ const toggle = page.locator(TOGGLE);
+ await expect(toggle).toBeVisible({ timeout: 20000 });
+ await expect(toggle.locator(INCOGNITO)).toBeVisible();
+ await expect(toggle).toHaveAttribute('aria-pressed', 'false');
+
+ await toggle.click();
+ await expect(toggle).toHaveAttribute('aria-pressed', 'true');
+
+ /** The welcome screen takes over the explanation, under the same mark. */
+ await expect(page.getByText('Temporary Chat', { exact: true }).first()).toBeVisible();
+ await expect(page.locator(INCOGNITO)).toHaveCount(2);
+ expect(await strokeOnly(page)).toBe(true);
+
+ /** Leave the account as the suite found it: the mode is persisted locally. */
+ await toggle.click();
+ await expect(toggle).toHaveAttribute('aria-pressed', 'false');
+ });
+});
+
+/** The mark is a lucide outline icon: it follows the text colour rather than
+ * painting a filled shape that would ignore the theme. */
+async function strokeOnly(page: Page): Promise<boolean> {
+ return page.evaluate((selector) => {
+ const icons = Array.from(document.querySelectorAll(selector));
+ return (
+ icons.length > 0 &&
+ icons.every((icon) => {
+ const style = getComputedStyle(icon);
+ return style.fill === 'none' && style.stroke !== 'none';
+ })
+ );
+ }, INCOGNITO);
+}
diff --git a/e2e/specs/mock/scenarios/welcome-disclaimer.spec.ts b/e2e/specs/mock/scenarios/welcome-disclaimer.spec.ts
new file mode 100644
index 0000000000..2b562068e7
--- /dev/null
+++ b/e2e/specs/mock/scenarios/welcome-disclaimer.spec.ts
@@ -0,0 +1,105 @@
+import { randomUUID } from 'crypto';
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { getE2EUser } from '../../../setup/user';
+import { deleteConversations, deleteMessagesByConversation, seedConversations } from '../db';
+
+/**
+ * The model disclaimer belongs to the welcome screen, where it is first read. It
+ * used to repeat under the composer in every conversation, and it carried
+ * `text-primary`, the weight of the greeting above it.
+ *
+ * The footer is hidden below `sm`, so both scenarios run on the desktop
+ * projects and skip the mobile one.
+ */
+
+const DISCLAIMER = 'a[href="https://librechat.ai"]';
+/** WCAG AA for body text; the disclaimer renders at 12px. */
+const AA_CONTRAST = 4.5;
+
+const skipBelowSm = (page: Page) => {
+ const width = page.viewportSize()?.width ?? 0;
+ test.skip(width < 640, 'the disclaimer is hidden below the sm breakpoint');
+};
+
+async function seedConversation(title: string) {
+ const conversationId = randomUUID();
+ await seedConversations(getE2EUser().email, [{ conversationId, title, updatedAt: new Date() }]);
+ return conversationId;
+}
+
+async function contrastOfDisclaimer(page: Page): Promise<number> {
+ return page.evaluate((selector) => {
+ const link = document.querySelector<HTMLElement>(selector);
+ if (!link) {
+ throw new Error('the disclaimer is not rendered');
+ }
+ const parse = (value: string): [number, number, number] => {
+ const parts = value.match(/[\d.]+/g);
+ if (!parts || parts.length < 3) {
+ throw new Error(`unreadable colour ${value}`);
+ }
+ return [Number(parts[0]), Number(parts[1]), Number(parts[2])];
+ };
+ const luminance = ([r, g, b]: [number, number, number]) => {
+ const channel = (value: number) => {
+ const ratio = value / 255;
+ return ratio <= 0.04045 ? ratio / 12.92 : ((ratio + 0.055) / 1.055) ** 2.4;
+ };
+ return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
+ };
+ /** The bar itself paints nothing; walk up to whatever fills behind it. */
+ let node: HTMLElement | null = link;
+ let background = 'rgba(0, 0, 0, 0)';
+ while (node) {
+ const painted = getComputedStyle(node).backgroundColor;
+ if (painted && painted !== 'rgba(0, 0, 0, 0)' && painted !== 'transparent') {
+ background = painted;
+ break;
+ }
+ node = node.parentElement;
+ }
+ const foreground = luminance(parse(getComputedStyle(link).color));
+ const behind = luminance(parse(background));
+ const lighter = Math.max(foreground, behind);
+ const darker = Math.min(foreground, behind);
+ return (lighter + 0.05) / (darker + 0.05);
+ }, DISCLAIMER);
+}
+
+test.describe('welcome screen disclaimer', () => {
+ test('the disclaimer stays on the welcome screen and leaves the conversation @scenario:welcome-screen-disclaimer-only', async ({
+ page,
+ }) => {
+ skipBelowSm(page);
+ const conversationId = await seedConversation('Disclaimer placement');
+
+ try {
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(DISCLAIMER)).toBeVisible();
+
+ await page.goto(`/c/${conversationId}`, { timeout: 10000 });
+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible();
+ await expect(page.locator(DISCLAIMER)).toHaveCount(0);
+
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(DISCLAIMER)).toBeVisible();
+ } finally {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+ }
+ });
+
+ test('the muted disclaimer still clears AA contrast @scenario:welcome-disclaimer-readable-while-muted', async ({
+ page,
+ }) => {
+ skipBelowSm(page);
+ await page.goto('/c/new', { timeout: 10000 });
+ await expect(page.locator(DISCLAIMER)).toBeVisible();
+
+ const contrast = await contrastOfDisclaimer(page);
+ expect(contrast).toBeGreaterThanOrEqual(AA_CONTRAST);
+ /** Muted, not merely readable: the greeting's own weight is far above this. */
+ expect(contrast).toBeLessThan(12);
+ });
+});
diff --git a/package-lock.json b/package-lock.json
index bc6867163f..4331589044 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -937,8 +937,8 @@
"js-cookie": "^3.0.5",
"librechat-data-provider": "*",
"lodash": "^4.17.23",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.528.0",
+ "lucide-react": "^0.528.0",
"match-sorter": "^8.1.0",
"mdast-util-directive": "^3.0.0",
"mdast-util-from-markdown": "^2.0.1",
@@ -30859,15 +30859,15 @@
"license": "ISC"
},
"node_modules/lucide": {
- "version": "0.525.0",
- "resolved": "https://registry.npmjs.org/lucide/-/lucide-0.525.0.tgz",
- "integrity": "sha512-sfehWlaE/7NVkcEQ4T9JD3eID8RNMIGJBBUq9wF3UFiJIrcMKRbU3g1KGfDk4svcW7yw8BtDLXaXo02scDtUYQ==",
+ "version": "0.528.0",
+ "resolved": "https://registry.npmjs.org/lucide/-/lucide-0.528.0.tgz",
+ "integrity": "sha512-ECgCnfShg2QV+ExL6PPBB304Vfc/+1B99K+2zmAiHBWUlst8lziRoloR7PVeBDENABCC0DbCpw5UpUi/GG3JdA==",
"license": "ISC"
},
"node_modules/lucide-react": {
- "version": "0.525.0",
- "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.525.0.tgz",
- "integrity": "sha512-Tm1txJ2OkymCGkvwoHt33Y2JpN5xucVq1slHcgE6Lk0WjDfjgKWor5CdVER8U6DvcfMwh4M8XxmpTiyzfmfDYQ==",
+ "version": "0.528.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.528.0.tgz",
+ "integrity": "sha512-Qeapzej+iIKQwOevWKtsSHJKkZh16ohe0Lm5bwdsmlMC7M3T9vIP+2jLiYjcvBl8Lekcc1BTtR4eUATqs3aAjw==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
@@ -43062,8 +43062,8 @@
"jotai": "^2.12.5",
"js-yaml": "^4.3.2",
"librechat-data-provider": "*",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.528.0",
+ "lucide-react": "^0.528.0",
"morphicons": "^1.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@@ -43113,8 +43113,8 @@
"input-otp": "^1.4.2",
"jotai": "^2.12.5",
"librechat-data-provider": "*",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.525.0 || ^0.528.0",
+ "lucide-react": "^0.525.0 || ^0.528.0",
"match-sorter": "^8.1.0",
"morphicons": "^1.4.1",
"rc-input-number": "^7.4.2",
diff --git a/packages/client/package.json b/packages/client/package.json
index d15f126d1f..47bf4c4ef4 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -78,8 +78,8 @@
"input-otp": "^1.4.2",
"jotai": "^2.12.5",
"librechat-data-provider": "*",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.525.0 || ^0.528.0",
+ "lucide-react": "^0.525.0 || ^0.528.0",
"match-sorter": "^8.1.0",
"morphicons": "^1.4.1",
"rc-input-number": "^7.4.2",
@@ -114,8 +114,8 @@
"jotai": "^2.12.5",
"js-yaml": "^4.3.2",
"librechat-data-provider": "*",
- "lucide": "^0.525.0",
- "lucide-react": "^0.525.0",
+ "lucide": "^0.528.0",
+ "lucide-react": "^0.528.0",
"morphicons": "^1.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",