add knowledge base tab

This commit is contained in:
cca313 2024-03-30 11:16:43 +08:00
parent 51691ee008
commit 7a32e8ba10
5 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,29 @@
'use client';
import dynamic from 'next/dynamic';
import { FC, memo } from 'react';
import { Flexbox } from 'react-layout-kit';
import ResponsiveIndex from '@/components/ResponsiveIndex';
import PageTitle from '../features/PageTitle';
import ChatHeader from './features/ChatHeader';
import Conversation from './features/Conversation';
import SideBar from './features/SideBar';
import Layout from './layout.desktop';
const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
const DesktopPage = memo(() => (
<ResponsiveIndex Mobile={Mobile}>
<Layout>
<PageTitle />
<ChatHeader />
<Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
<Conversation />
<SideBar />
</Flexbox>
</Layout>
</ResponsiveIndex>
));
export default DesktopPage;

View File

@ -0,0 +1,23 @@
'use client';
import { PropsWithChildren, memo } from 'react';
import { Flexbox } from 'react-layout-kit';
import AppLayoutDesktop from '@/layout/AppLayout.desktop';
import { SidebarTabKey } from '@/store/global/initialState';
export default memo(({ children }: PropsWithChildren) => {
return (
<AppLayoutDesktop sidebarKey={SidebarTabKey.Chat}>
<Flexbox
flex={1}
height={'100%'}
id={'lobe-conversion-container'}
style={{ position: 'relative' }}
>
{children}
</Flexbox>
</AppLayoutDesktop>
);
});

View File

@ -0,0 +1,9 @@
const Page = () => {
// const mobile = isMobileDevice();
// const Page = mobile ? MobilePage : DesktopPage;
return <div>321</div>;
};
export default Page;

View File

@ -1,5 +1,5 @@
import { ActionIcon } from '@lobehub/ui';
import { Compass, MessageSquare } from 'lucide-react';
import { Compass, Library, MessageSquare } from 'lucide-react';
import Link from 'next/link';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@ -43,6 +43,15 @@ const TopActions = memo<TopActionProps>(({ tab }) => {
title={t('tab.market')}
/>
</Link>
<Link aria-label={'知识库'} href={'/knowledge'}>
<ActionIcon
active={tab === SidebarTabKey.Knowledge}
icon={Library}
placement={'right'}
size="large"
title={'知识库'}
/>
</Link>
</>
);
});

View File

@ -2,6 +2,7 @@ import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.share
export enum SidebarTabKey {
Chat = 'chat',
Knowledge = 'knowledge',
Market = 'market',
Setting = 'settings',
}