mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-01 00:05:43 +08:00
### What problem does this PR solve? Feat: Integrate the name, avatar, and description of chat and search into a single component. ### Type of change - [x] New Feature (non-breaking change which adds functionality) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Inline-editable avatar, name, and description fields * Expandable content blocks in search results * New RAGFlow heading/logo component * **Refactor** * Replaced scattered form fields with a composed Avatar/Name/Description component * Mindmap drawer converted to a sheet-based drawer and layout cleanup * Simplified search page controls and layout; improved scroll viewport handling * **Chores** * Added/updated English and Chinese localization keys (placeholders, view more/less) <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
114 lines
2.9 KiB
TypeScript
114 lines
2.9 KiB
TypeScript
import { Toaster as Sonner } from '@/components/ui/sonner';
|
|
import { Toaster } from '@/components/ui/toaster';
|
|
import { changeLanguageAsync } from '@/locales/config';
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import { configResponsive } from 'ahooks';
|
|
import dayjs from 'dayjs';
|
|
import 'dayjs/locale/ar';
|
|
import 'dayjs/locale/tr';
|
|
import 'dayjs/locale/zh-cn';
|
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
import localeData from 'dayjs/plugin/localeData';
|
|
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
import weekYear from 'dayjs/plugin/weekYear';
|
|
import weekday from 'dayjs/plugin/weekday';
|
|
import React, { useEffect } from 'react';
|
|
import { RouterProvider } from 'react-router';
|
|
import { ThemeProvider } from './components/theme-provider';
|
|
import { TooltipProvider } from './components/ui/tooltip';
|
|
import { ThemeEnum } from './constants/common';
|
|
import { routers } from './routes';
|
|
import storage from './utils/authorization-util';
|
|
|
|
import 'react-photo-view/dist/react-photo-view.css';
|
|
|
|
configResponsive({
|
|
sm: 640,
|
|
md: 768,
|
|
lg: 1024,
|
|
xl: 1280,
|
|
'2xl': 1536,
|
|
'3xl': 1780,
|
|
'4xl': 1980,
|
|
});
|
|
|
|
dayjs.extend(customParseFormat);
|
|
dayjs.extend(advancedFormat);
|
|
dayjs.extend(weekday);
|
|
dayjs.extend(localeData);
|
|
dayjs.extend(weekOfYear);
|
|
dayjs.extend(weekYear);
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
import('@welldone-software/why-did-you-render').then(
|
|
(whyDidYouRenderModule) => {
|
|
const whyDidYouRender = whyDidYouRenderModule.default;
|
|
whyDidYouRender(React, {
|
|
trackAllPureComponents: true,
|
|
trackExtraHooks: [],
|
|
logOnDifferentValues: false,
|
|
exclude: [/^RouterProvider$/],
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
refetchOnWindowFocus: false,
|
|
retry: 2,
|
|
},
|
|
},
|
|
});
|
|
|
|
function Root({ children }: React.PropsWithChildren) {
|
|
return (
|
|
<>
|
|
{children}
|
|
|
|
<Sonner position="top-right" expand richColors closeButton />
|
|
|
|
<Toaster />
|
|
</>
|
|
);
|
|
}
|
|
|
|
const RootProvider = ({ children }: React.PropsWithChildren) => {
|
|
useEffect(() => {
|
|
const lng = storage.getLanguage();
|
|
if (lng) {
|
|
void changeLanguageAsync(lng);
|
|
}
|
|
}, []);
|
|
|
|
return (
|
|
<TooltipProvider>
|
|
<QueryClientProvider client={queryClient}>
|
|
<ThemeProvider
|
|
defaultTheme={ThemeEnum.Dark}
|
|
storageKey="ragflow-ui-theme"
|
|
>
|
|
<Root>{children}</Root>
|
|
</ThemeProvider>
|
|
</QueryClientProvider>
|
|
</TooltipProvider>
|
|
);
|
|
};
|
|
|
|
const RouterProviderWrapper: React.FC<{ router: typeof routers }> = ({
|
|
router,
|
|
}) => {
|
|
return <RouterProvider router={router}></RouterProvider>;
|
|
};
|
|
RouterProviderWrapper.whyDidYouRender = false;
|
|
|
|
export default function AppContainer() {
|
|
return (
|
|
<RootProvider>
|
|
<RouterProviderWrapper router={routers} />
|
|
</RootProvider>
|
|
);
|
|
}
|