mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-20 06:51:59 +00:00
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Has been cancelled
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been cancelled
* fix: Follow the Interface Direction in Radix, the Composer and First Paint Wrap the app in a Radix DirectionProvider driven by i18n so Tabs, Select and menus stop rendering LTR subtrees in right-to-left locales, and swipe toasts toward the inline end. Chat direction becomes auto, ltr or rtl (auto by default; stored LTR/RTL values are kept). The composer applies a forced direction as a dir attribute instead of reversing rows, which double-flipped under an RTL document, and the text fields default to dir=auto. The unused Jotai chat direction atom that pinned every TextareaAutosize to ltr is removed. index.html sets dir before first paint, and the language setting no longer races i18n over document.lang. * fix: Keep the Empty Composer Placeholder on the Interface's Reading Edge
110 lines
4.1 KiB
JavaScript
110 lines
4.1 KiB
JavaScript
import { useEffect } from 'react';
|
|
import { RecoilRoot } from 'recoil';
|
|
import { DndProvider } from 'react-dnd';
|
|
import { RouterProvider } from 'react-router-dom';
|
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
import { Toast, ToastViewport, ToastProvider, useInputModality } from '@librechat/client';
|
|
import { QueryClient, QueryClientProvider, QueryCache, MutationCache } from '@tanstack/react-query';
|
|
import Direction, { ToastSwipeProvider } from '~/Providers/Direction';
|
|
import { ScreenshotProvider, useApiErrorBoundary } from './hooks';
|
|
import WakeLockManager from '~/components/System/WakeLockManager';
|
|
import QueryDevtoolsGate from '~/components/QueryDevtoolsGate';
|
|
import LanguageSync from '~/components/System/LanguageSync';
|
|
import DeploymentTheme from '~/Providers/DeploymentTheme';
|
|
import UiScaleSync from '~/components/System/UiScaleSync';
|
|
import { initializeFontSize } from '~/store/fontSize';
|
|
import { reopenTermsOnRefusal } from '~/utils/terms';
|
|
import { LiveAnnouncer } from '~/a11y';
|
|
import { router } from './routes';
|
|
|
|
const App = () => {
|
|
const { setError } = useApiErrorBoundary();
|
|
useInputModality();
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
// Always attempt network requests, even when navigator.onLine is false
|
|
// This is needed because localhost is reachable without WiFi
|
|
networkMode: 'always',
|
|
},
|
|
mutations: {
|
|
networkMode: 'always',
|
|
},
|
|
},
|
|
queryCache: new QueryCache({
|
|
onError: (error) => {
|
|
if (error?.response?.status === 401) {
|
|
setError(error);
|
|
}
|
|
},
|
|
}),
|
|
mutationCache: new MutationCache({
|
|
onError: (error) => {
|
|
reopenTermsOnRefusal(queryClient, error?.response?.data);
|
|
},
|
|
}),
|
|
});
|
|
|
|
useEffect(() => {
|
|
initializeFontSize();
|
|
}, []);
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<RecoilRoot>
|
|
<LanguageSync />
|
|
<UiScaleSync />
|
|
<Direction>
|
|
<LiveAnnouncer>
|
|
<DeploymentTheme>
|
|
<ToastSwipeProvider>
|
|
<ToastProvider>
|
|
<DndProvider backend={HTML5Backend}>
|
|
{/* Location updates commit in the caller's own task instead
|
|
of React's transition lane. A transition keeps the
|
|
OUTGOING route painted until the incoming one finishes
|
|
rendering, so switching conversations left the previous
|
|
transcript on screen under the new URL for as long as the
|
|
next thread took to render.
|
|
|
|
Set here rather than per navigation because the property
|
|
is route-shaped, not caller-shaped: fourteen call sites
|
|
across components, chat hooks and SSE handlers navigate
|
|
into `/c/*`, and an opt-out passed at each one is a list
|
|
that silently rots as call sites are added. Nothing in the
|
|
app reads route data through router loaders or renders
|
|
pending UI from `useNavigation`, so the transition buys no
|
|
interstitial on any route — it only defers the commit. And
|
|
conversation state still lives in Recoil, whose
|
|
transition-safe reads are gated behind
|
|
`_TRANSITION_SUPPORT_UNSTABLE` hooks this app does not use.
|
|
Worth revisiting once that state has moved to Jotai. */}
|
|
<RouterProvider router={router} useTransitions={false} />
|
|
<WakeLockManager />
|
|
<QueryDevtoolsGate />
|
|
<Toast />
|
|
<ToastViewport />
|
|
</DndProvider>
|
|
</ToastProvider>
|
|
</ToastSwipeProvider>
|
|
</DeploymentTheme>
|
|
</LiveAnnouncer>
|
|
</Direction>
|
|
</RecoilRoot>
|
|
</QueryClientProvider>
|
|
);
|
|
};
|
|
|
|
export default () => (
|
|
<ScreenshotProvider>
|
|
<App />
|
|
<iframe
|
|
src="assets/silence.mp3"
|
|
allow="autoplay"
|
|
id="audio"
|
|
title="audio-silence"
|
|
className="hidden"
|
|
/>
|
|
</ScreenshotProvider>
|
|
);
|