diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx
index fd13848655..37481897e8 100644
--- a/client/src/components/Chat/Input/ChatForm.tsx
+++ b/client/src/components/Chat/Input/ChatForm.tsx
@@ -1083,9 +1083,9 @@ function ChatFormWrapper({
project,
routePending = false,
isLandingPage,
- /** Defaults to the atom's own default (`atomWithLocalStorage('enterToSend',
- * true)`) so call sites that predate this prop, mainly tests, keep their
- * prior behavior without passing it explicitly. */
+ /** Enter sends unless told otherwise, so call sites that predate this prop,
+ * mainly tests, keep their prior behavior without passing it explicitly.
+ * ChatView always passes the user's preference, whose default is false. */
enterToSend = true,
/** Same reason, from `atomWithLocalStorage('autoSendText', -1)`. */
autoSendText = -1,
diff --git a/client/src/components/Chat/Input/__tests__/ChatForm.enterToSend.spec.tsx b/client/src/components/Chat/Input/__tests__/ChatForm.enterToSend.spec.tsx
index 14eeae5dbf..aa8d41b8ce 100644
--- a/client/src/components/Chat/Input/__tests__/ChatForm.enterToSend.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/ChatForm.enterToSend.spec.tsx
@@ -24,10 +24,9 @@ const conversation = {
} as TConversation;
/**
- * The atom default (`atomWithLocalStorage('enterToSend', true)`) always stays
- * true here: these tests prove the composer follows the `enterToSend` prop
- * ChatView passes it, not the atom it used to read directly, so the prop is
- * deliberately set opposite to that default.
+ * The atom keeps its default (`atomWithLocalStorage('enterToSend', false)`)
+ * here: these tests prove the composer follows the `enterToSend` prop ChatView
+ * passes it, not the atom it used to read directly, so each value is covered.
*/
function Harness({ enterToSend }: { enterToSend: boolean }) {
const [files, setFiles] = useRecoilState(store.filesByIndex(0));
@@ -111,7 +110,7 @@ describe('ChatForm enterToSend prop', () => {
localStorage.clear();
});
- test('follows the prop when it disagrees with the persisted default', async () => {
+ test('follows the prop when it agrees with the persisted default', async () => {
renderComposer({ enterToSend: false });
const textarea = await screen.findByTestId('text-input');
@@ -123,7 +122,7 @@ describe('ChatForm enterToSend prop', () => {
expect(hint).not.toHaveTextContent('Enter to send');
}, 20000);
- test('reflects the prop when it agrees with the persisted default', async () => {
+ test('follows the prop when it disagrees with the persisted default', async () => {
renderComposer({ enterToSend: true });
const textarea = await screen.findByTestId('text-input');
diff --git a/client/src/components/Chat/__tests__/ChatView.spec.tsx b/client/src/components/Chat/__tests__/ChatView.spec.tsx
index ab56e2927a..eee42fac17 100644
--- a/client/src/components/Chat/__tests__/ChatView.spec.tsx
+++ b/client/src/components/Chat/__tests__/ChatView.spec.tsx
@@ -134,11 +134,11 @@ describe('ChatView composer preferences', () => {
* reaching into app-global state the composer only consumes. ChatView now owns the
* read and passes it down, the same boundary `showComposerTips` already follows. */
test('reads the persisted enterToSend preference and passes it into ChatForm', () => {
- localStorage.setItem('enterToSend', JSON.stringify(false));
+ localStorage.setItem('enterToSend', JSON.stringify(true));
render();
- expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: false }));
+ expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: true }));
});
/** The same boundary for the dictation preferences: ChatForm consumes them
@@ -161,7 +161,7 @@ describe('ChatView composer preferences', () => {
test('falls back to the atom default when nothing is persisted', () => {
render();
- expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: true }));
+ expect(mockChatFormProps).toHaveBeenCalledWith(expect.objectContaining({ enterToSend: false }));
});
});
diff --git a/client/src/hooks/Files/__tests__/useClientResize.spec.tsx b/client/src/hooks/Files/__tests__/useClientResize.spec.tsx
index 7699a3c229..95d925c7d9 100644
--- a/client/src/hooks/Files/__tests__/useClientResize.spec.tsx
+++ b/client/src/hooks/Files/__tests__/useClientResize.spec.tsx
@@ -132,10 +132,10 @@ describe('useClientResize', () => {
expect(result.current.isEnforced).toBe(false);
});
- it('defaults to off when the user has no stored setting', () => {
+ it('defaults to on when the user has no stored setting', () => {
const { result } = renderHook(() => useClientResize(), { wrapper });
- expect(result.current.isEnabled).toBe(false);
+ expect(result.current.isEnabled).toBe(true);
});
});
diff --git a/client/src/store/__tests__/defaults.spec.ts b/client/src/store/__tests__/defaults.spec.ts
new file mode 100644
index 0000000000..fddc2d04de
--- /dev/null
+++ b/client/src/store/__tests__/defaults.spec.ts
@@ -0,0 +1,73 @@
+import { createStore } from 'jotai';
+import { snapshot_UNSTABLE } from 'recoil';
+import type { RecoilState } from 'recoil';
+import settings from '../settings';
+
+const readRecoil = (atom: RecoilState): T =>
+ snapshot_UNSTABLE().getLoadable(atom).valueOrThrow();
+
+/**
+ * The Jotai atom reads storage once, when its module is evaluated (as on page
+ * load), so each case seeds storage first and then loads a fresh copy.
+ */
+const readAutoScroll = (): boolean => {
+ let value = false;
+ jest.isolateModules(() => {
+ const { autoScrollAtom } = jest.requireActual('../autoScroll');
+ value = createStore().get(autoScrollAtom);
+ });
+ return value;
+};
+
+describe('preference defaults with nothing persisted', () => {
+ beforeEach(() => {
+ localStorage.clear();
+ });
+
+ it('adds a newline on Enter instead of sending', () => {
+ expect(readRecoil(settings.enterToSend)).toBe(false);
+ });
+
+ it('collapses long user messages', () => {
+ expect(readRecoil(settings.collapseLongUserMessages)).toBe(true);
+ });
+
+ it('resizes images before upload', () => {
+ expect(readRecoil(settings.clientImageResize)).toBe(true);
+ });
+
+ it('scrolls to the latest message on chat open', () => {
+ expect(readAutoScroll()).toBe(true);
+ });
+});
+
+/** Guards: a choice saved under the old defaults survives the change. */
+describe('persisted preferences', () => {
+ beforeEach(() => {
+ localStorage.clear();
+ });
+
+ it('keeps a saved Enter to send', () => {
+ localStorage.setItem('enterToSend', JSON.stringify(true));
+
+ expect(readRecoil(settings.enterToSend)).toBe(true);
+ });
+
+ it('keeps a saved opt-out of collapsing', () => {
+ localStorage.setItem('collapseLongUserMessages', JSON.stringify(false));
+
+ expect(readRecoil(settings.collapseLongUserMessages)).toBe(false);
+ });
+
+ it('keeps a saved opt-out of resizing', () => {
+ localStorage.setItem('clientImageResize', JSON.stringify(false));
+
+ expect(readRecoil(settings.clientImageResize)).toBe(false);
+ });
+
+ it('keeps a saved opt-out of auto-scroll', () => {
+ localStorage.setItem('autoScroll', JSON.stringify(false));
+
+ expect(readAutoScroll()).toBe(false);
+ });
+});
diff --git a/client/src/store/autoScroll.ts b/client/src/store/autoScroll.ts
index e5e1fa8b2e..3fa025c937 100644
--- a/client/src/store/autoScroll.ts
+++ b/client/src/store/autoScroll.ts
@@ -1,6 +1,6 @@
import { createStorageAtom } from './jotai-utils';
-const DEFAULT_AUTO_SCROLL = false;
+const DEFAULT_AUTO_SCROLL = true;
/**
* Whether opening a conversation lands the reader on its newest message.
diff --git a/client/src/store/settings.ts b/client/src/store/settings.ts
index 7546290751..6c66181d09 100644
--- a/client/src/store/settings.ts
+++ b/client/src/store/settings.ts
@@ -57,7 +57,7 @@ const localStorageAtoms = {
chatTitleInTab: atomWithLocalStorage(CHAT_TITLE_IN_TAB_KEY, true),
// Chat settings
- enterToSend: atomWithLocalStorage('enterToSend', true),
+ enterToSend: atomWithLocalStorage('enterToSend', false),
maximizeChatSpace: atomWithLocalStorage('maximizeChatSpace', false),
chatDirection: atomWithLocalStorage('chatDirection', 'LTR'),
autoExpandTools: atomWithLocalStorage(LocalStorageKeys.AUTO_EXPAND_TOOLS, false),
@@ -67,7 +67,7 @@ const localStorageAtoms = {
* "Show more" toggle. The clamp is visual only; the full text stays in
* the DOM, copyable and searchable.
*/
- collapseLongUserMessages: atomWithLocalStorage('collapseLongUserMessages', false),
+ collapseLongUserMessages: atomWithLocalStorage('collapseLongUserMessages', true),
/**
* Whether pasting a large block of text attaches it as a `.txt` file instead of
* flooding the composer. The text still reaches the model in full.
@@ -79,7 +79,7 @@ const localStorageAtoms = {
rememberDefaultFork: atomWithLocalStorage(LocalStorageKeys.REMEMBER_FORK_OPTION, false),
saveBadgesState: atomWithLocalStorage('saveBadgesState', false),
/** User preference for downscaling images before upload; ignored when the admin config sets it */
- clientImageResize: atomWithLocalStorage('clientImageResize', false),
+ clientImageResize: atomWithLocalStorage('clientImageResize', true),
/**
* Whether copying a message also puts a rendered HTML version on the
* clipboard, so apps that ignore Markdown (Teams, Outlook, Word) paste the
diff --git a/e2e/setup/authenticate.ts b/e2e/setup/authenticate.ts
index 3e5d4276a2..b9390b7d1d 100644
--- a/e2e/setup/authenticate.ts
+++ b/e2e/setup/authenticate.ts
@@ -67,9 +67,11 @@ async function authenticate(config: FullConfig, user: User) {
const conversationURL = appURL(baseURL, 'c/new');
const loginURL = appURL(baseURL, 'login');
- // Set localStorage before navigating to the page
+ // Set localStorage before navigating to the page. Specs send with Enter, which the
+ // app no longer does by default, so the saved state opts into it.
await page.context().addInitScript(() => {
localStorage.setItem('navVisible', 'true');
+ localStorage.setItem('enterToSend', 'true');
});
console.log('🤖: ✔️ localStorage: set Nav as Visible', storageState);
diff --git a/e2e/setup/record.js b/e2e/setup/record.js
index 70052a2b78..eac0d57d5d 100644
--- a/e2e/setup/record.js
+++ b/e2e/setup/record.js
@@ -316,8 +316,10 @@ async function writeStorageState(env, storagePath) {
try {
const page = await browser.newPage();
+ /** Specs send with Enter, which the app no longer does by default. */
await page.context().addInitScript(() => {
localStorage.setItem('navVisible', 'true');
+ localStorage.setItem('enterToSend', 'true');
});
await page.goto(baseURL, { timeout });
diff --git a/e2e/specs/mock/code-upload.spec.ts b/e2e/specs/mock/code-upload.spec.ts
index a30c6e89b6..53f098afa6 100644
--- a/e2e/specs/mock/code-upload.spec.ts
+++ b/e2e/specs/mock/code-upload.spec.ts
@@ -42,9 +42,13 @@ const TURN2_MARKER_NEEDLE = 'turn1-proof-42';
const uniqueName = (prefix: string) => `${prefix} ${Date.now()}-${Math.floor(Math.random() * 1e4)}`;
const modelTrigger = (page: Page) => page.getByRole('button', { name: 'Select a model' }).first();
+/** Restores the Enter opt-in from global setup, since the send helpers press Enter. */
async function startFresh(page: Page) {
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
- await page.evaluate(() => localStorage.clear());
+ await page.evaluate(() => {
+ localStorage.clear();
+ localStorage.setItem('enterToSend', 'true');
+ });
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
}
diff --git a/e2e/specs/mock/scenarios/denied-web-storage.spec.ts b/e2e/specs/mock/scenarios/denied-web-storage.spec.ts
index 995f3b0510..3df2d8896b 100644
--- a/e2e/specs/mock/scenarios/denied-web-storage.spec.ts
+++ b/e2e/specs/mock/scenarios/denied-web-storage.spec.ts
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';
import type { Page } from '@playwright/test';
-import { NEW_CHAT_PATH, messagesView, replyPrompt, replyText, sendMessage } from '../helpers';
+import { NEW_CHAT_PATH, isAgentsStream, messagesView, replyPrompt, replyText } from '../helpers';
/**
* A browser that denies Web Storage by policy throws a `SecurityError` from the
@@ -71,7 +71,14 @@ test.describe('denied web storage', () => {
await denyWebStorage(page);
await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
- await sendMessage(page, replyPrompt('denied-storage'));
+ /** No stored preference can load, so Enter writes a newline by default and
+ * Ctrl/Cmd+Enter sends. `sendMessage` relies on the stored Enter opt-in. */
+ const input = page.getByRole('textbox', { name: 'Message input' });
+ await input.fill(replyPrompt('denied-storage'));
+ await Promise.all([
+ page.waitForResponse(isAgentsStream, { timeout: 30000 }),
+ input.press('ControlOrMeta+Enter'),
+ ]);
await expect(messagesView(page).getByText(replyText('denied-storage'))).toBeVisible({
timeout: 30000,
});
diff --git a/e2e/specs/mock/soft-default.spec.ts b/e2e/specs/mock/soft-default.spec.ts
index 20b550abf7..d433550942 100644
--- a/e2e/specs/mock/soft-default.spec.ts
+++ b/e2e/specs/mock/soft-default.spec.ts
@@ -25,10 +25,14 @@ const uniqueName = (prefix: string) => `${prefix} ${Date.now()}-${Math.floor(Mat
const modelTrigger = (page: Page) => page.getByRole('button', { name: 'Select a model' }).first();
-/** Reset selection state so the test starts as a fresh instance (auth stays in cookies). */
+/** Reset selection state so the test starts as a fresh instance (auth stays in cookies).
+ * The Enter opt-in from global setup is restored because `sendMessage` presses Enter. */
async function startFresh(page: Page) {
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
- await page.evaluate(() => localStorage.clear());
+ await page.evaluate(() => {
+ localStorage.clear();
+ localStorage.setItem('enterToSend', 'true');
+ });
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
}
@@ -198,7 +202,10 @@ test.describe('soft default model spec', () => {
await expect(modelTrigger(page)).toContainText(agentName, { timeout: 15000 });
// The soft default still owns the fresh-instance landing under this allow-list.
- await page.evaluate(() => localStorage.clear());
+ await page.evaluate(() => {
+ localStorage.clear();
+ localStorage.setItem('enterToSend', 'true');
+ });
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
await expect(modelTrigger(page)).toContainText(SOFT_DEFAULT_LABEL, { timeout: 15000 });
});
diff --git a/e2e/specs/mock/steering.spec.ts b/e2e/specs/mock/steering.spec.ts
index 56419f5582..d92c290474 100644
--- a/e2e/specs/mock/steering.spec.ts
+++ b/e2e/specs/mock/steering.spec.ts
@@ -180,6 +180,10 @@ test.describe('mid-run steering and queuing', () => {
page,
}) => {
test.setTimeout(150000);
+ /* This covers code layout, not collapsing, which is on by default. */
+ await page.addInitScript(() => {
+ localStorage.setItem('collapseLongUserMessages', JSON.stringify(false));
+ });
const label = uniqueLabel('steer-code-layout');
const steerText = `Please use this example:\n\n\`\`\`js\n${`const payload = '${'x'.repeat(300)}';\n`.repeat(12)}\`\`\``;
@@ -233,7 +237,7 @@ test.describe('mid-run steering and queuing', () => {
await language.scrollIntoViewIfNeeded();
await expect(language).toBeInViewport();
}
- // Canary collapses long user messages only when that preference is enabled.
+ // Long user messages collapse only while that preference is on; it is off here.
await expect(row.getByRole('button', { name: 'Show more' })).toHaveCount(0);
});
diff --git a/librechat.example.yaml b/librechat.example.yaml
index 9c9b7e1d22..884fdcac37 100644
--- a/librechat.example.yaml
+++ b/librechat.example.yaml
@@ -1426,7 +1426,7 @@ endpoints:
# # Users can toggle this in Settings > Chat. Setting `enabled` here overrides
# # that choice for everyone and locks the toggle; omit it to leave users in control.
# clientImageResize:
-# enabled: false # Enable/disable client-side image resizing (default: false)
+# enabled: false # Force resizing on (true) or off (false) for everyone; omit it and each user decides, with resizing on by default
# maxWidth: 1900 # Maximum width for resized images (default: 1900)
# maxHeight: 1900 # Maximum height for resized images (default: 1900)
# quality: 0.92 # JPEG quality for compression (0.0-1.0, default: 0.92)