@lobehub/chat 0.133.4 → 0.133.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.133.5](https://github.com/lobehub/lobe-chat/compare/v0.133.4...v0.133.5)
6
+
7
+ <sup>Released on **2024-03-12**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
5
22
  ### [Version 0.133.4](https://github.com/lobehub/lobe-chat/compare/v0.133.3...v0.133.4)
6
23
 
7
24
  <sup>Released on **2024-03-11**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.133.4",
3
+ "version": "0.133.5",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -4,7 +4,8 @@ import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
- import ResponsiveIndex from '@/components/ResponsiveIndex';
7
+ import ResponsiveContainer from '@/components/ResponsiveContainer';
8
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
8
9
 
9
10
  import PageTitle from '../features/PageTitle';
10
11
  import ChatHeader from './features/ChatHeader';
@@ -12,10 +13,13 @@ import Conversation from './features/Conversation';
12
13
  import SideBar from './features/SideBar';
13
14
  import Layout from './layout.desktop';
14
15
 
15
- const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
16
+ const Mobile: FC = dynamic(() => import('../(mobile)'), {
17
+ loading: MobileSwitchLoading,
18
+ ssr: false,
19
+ }) as FC;
16
20
 
17
21
  const DesktopPage = memo(() => (
18
- <ResponsiveIndex Mobile={Mobile}>
22
+ <ResponsiveContainer Mobile={Mobile}>
19
23
  <Layout>
20
24
  <PageTitle />
21
25
  <ChatHeader />
@@ -24,6 +28,6 @@ const DesktopPage = memo(() => (
24
28
  <SideBar />
25
29
  </Flexbox>
26
30
  </Layout>
27
- </ResponsiveIndex>
31
+ </ResponsiveContainer>
28
32
  ));
29
33
  export default DesktopPage;
@@ -4,20 +4,24 @@ import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
 
6
6
  import SessionHydration from '@/app/chat/components/SessionHydration';
7
- import ResponsiveIndex from '@/components/ResponsiveIndex';
7
+ import ResponsiveContainer from '@/components/ResponsiveContainer';
8
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
8
9
 
9
10
  import EditPage from '../features/EditPage';
10
11
  import Layout from './layout.desktop';
11
12
 
12
- const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
13
+ const Mobile: FC = dynamic(() => import('../(mobile)'), {
14
+ loading: MobileSwitchLoading,
15
+ ssr: false,
16
+ }) as FC;
13
17
 
14
18
  const ChatSettings = memo(() => (
15
19
  <>
16
- <ResponsiveIndex Mobile={Mobile}>
20
+ <ResponsiveContainer Mobile={Mobile}>
17
21
  <Layout>
18
22
  <EditPage />
19
23
  </Layout>
20
- </ResponsiveIndex>
24
+ </ResponsiveContainer>
21
25
  <SessionHydration />
22
26
  </>
23
27
  ));
@@ -4,19 +4,23 @@ import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
4
4
  import dynamic from 'next/dynamic';
5
5
  import { FC, memo } from 'react';
6
6
 
7
- import AgentCard from '@/app/market/features/AgentCard';
8
- import ResponsiveIndex from '@/components/ResponsiveIndex';
7
+ import ResponsiveContainer from '@/components/ResponsiveContainer';
8
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
9
9
 
10
+ import AgentCard from '../features/AgentCard';
10
11
  import Index from '../index';
11
12
  import Layout from './layout.desktop';
12
13
 
13
- const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
14
+ const Mobile: FC = dynamic(() => import('../(mobile)'), {
15
+ loading: MobileSwitchLoading,
16
+ ssr: false,
17
+ }) as FC;
14
18
 
15
19
  export default memo(() => (
16
- <ResponsiveIndex Mobile={Mobile}>
20
+ <ResponsiveContainer Mobile={Mobile}>
17
21
  <Layout>
18
22
  <Index />
19
23
  <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
20
24
  </Layout>
21
- </ResponsiveIndex>
25
+ </ResponsiveContainer>
22
26
  ));
@@ -3,19 +3,23 @@
3
3
  import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
 
6
- import ResponsiveIndex from '@/components/ResponsiveIndex';
6
+ import ResponsiveContainer from '@/components/ResponsiveContainer';
7
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
7
8
  import { SettingsTabs } from '@/store/global/initialState';
8
9
 
9
10
  import Common from '../common';
10
11
  import { SettingsCommonProps } from '../common/Common';
11
12
  import DesktopLayout from './layout.desktop';
12
13
 
13
- const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
14
+ const Mobile: FC = dynamic(() => import('../(mobile)'), {
15
+ loading: MobileSwitchLoading,
16
+ ssr: false,
17
+ }) as FC;
14
18
 
15
19
  export default memo<SettingsCommonProps>((props) => (
16
- <ResponsiveIndex Mobile={Mobile}>
20
+ <ResponsiveContainer Mobile={Mobile}>
17
21
  <DesktopLayout activeTab={SettingsTabs.Common}>
18
22
  <Common {...props} />
19
23
  </DesktopLayout>
20
- </ResponsiveIndex>
24
+ </ResponsiveContainer>
21
25
  ));
@@ -3,11 +3,16 @@
3
3
  import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
 
6
- import ResponsiveLayout from '@/layout/ResponsiveLayout.client';
6
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
7
+ // TODO: need to be removed
8
+ import ResponsiveLayout from '@/layout/ServerResponsiveLayout/Client';
7
9
 
8
10
  import DesktopLayout, { DesktopLayoutProps } from './layout.desktop';
9
11
 
10
- const MobileLayout = dynamic(() => import('../(mobile)/layout.mobile'), { ssr: false }) as FC;
12
+ const MobileLayout = dynamic(() => import('../(mobile)/layout.mobile'), {
13
+ loading: MobileSwitchLoading,
14
+ ssr: false,
15
+ }) as FC;
11
16
 
12
17
  export default memo<DesktopLayoutProps>(({ children, activeTab }) => (
13
18
  <ResponsiveLayout Desktop={DesktopLayout} Mobile={MobileLayout} activeTab={activeTab}>
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren, ReactNode, memo } from 'react';
2
2
 
3
- import ResponsiveLayout from '@/layout/ResponsiveLayout.server';
3
+ import ResponsiveLayout from '@/layout/ServerResponsiveLayout';
4
4
  import { SettingsTabs } from '@/store/global/initialState';
5
5
 
6
6
  import DesktopLayout from './(desktop)/layout.responsive';
@@ -3,19 +3,23 @@
3
3
  import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
 
6
- import ResponsiveIndex from '@/components/ResponsiveIndex';
6
+ import ResponsiveContainer from '@/components/ResponsiveContainer';
7
+ import MobileSwitchLoading from '@/features/MobileSwitchLoading';
7
8
 
8
9
  import Footer from './features/Footer';
9
10
  import Showcase from './features/Showcase';
10
11
  import Layout from './layout.desktop';
11
12
 
12
- const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
13
+ const Mobile: FC = dynamic(() => import('../(mobile)'), {
14
+ loading: MobileSwitchLoading,
15
+ ssr: false,
16
+ }) as FC;
13
17
 
14
18
  export default memo(() => (
15
- <ResponsiveIndex Mobile={Mobile}>
19
+ <ResponsiveContainer Mobile={Mobile}>
16
20
  <Layout>
17
21
  <Showcase />
18
22
  <Footer />
19
23
  </Layout>
20
- </ResponsiveIndex>
24
+ </ResponsiveContainer>
21
25
  ));
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+
3
+ import { FC, ReactNode, memo } from 'react';
4
+
5
+ import { useIsMobile } from '@/hooks/useIsMobile';
6
+
7
+ interface ResponsiveContainerProps {
8
+ Mobile: FC;
9
+ children: ReactNode;
10
+ }
11
+
12
+ const ResponsiveContainer = memo(({ children, Mobile }: ResponsiveContainerProps) => {
13
+ const mobile = useIsMobile();
14
+
15
+ return mobile ? <Mobile /> : children;
16
+ });
17
+
18
+ ResponsiveContainer.displayName = 'ResponsiveContainer';
19
+
20
+ export default ResponsiveContainer;
@@ -0,0 +1,11 @@
1
+ import { useTranslation } from 'react-i18next';
2
+
3
+ import FullscreenLoading from '@/components/FullscreenLoading';
4
+
5
+ const MobileSwitchLoading = () => {
6
+ const { t } = useTranslation('common');
7
+
8
+ return <FullscreenLoading title={t('layoutInitializing')} />;
9
+ };
10
+
11
+ export default MobileSwitchLoading;
@@ -1,9 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { ReactNode, Suspense, memo } from 'react';
4
- import { useTranslation } from 'react-i18next';
3
+ import { ReactNode, memo } from 'react';
5
4
 
6
- import FullscreenLoading from '@/components/FullscreenLoading';
7
5
  import { useIsMobile } from '@/hooks/useIsMobile';
8
6
 
9
7
  interface ServerResponsiveLayoutProps extends Record<string, any> {
@@ -14,16 +12,9 @@ interface ServerResponsiveLayoutProps extends Record<string, any> {
14
12
 
15
13
  const ResponsiveLayout = memo(
16
14
  ({ children, Desktop, Mobile, ...res }: ServerResponsiveLayoutProps) => {
17
- const { t } = useTranslation();
18
15
  const mobile = useIsMobile();
19
16
 
20
- return mobile ? (
21
- <Suspense fallback={<FullscreenLoading title={t('layoutInitializing', { ns: 'common' })} />}>
22
- <Mobile {...res}>{children}</Mobile>
23
- </Suspense>
24
- ) : (
25
- <Desktop {...res}>{children}</Desktop>
26
- );
17
+ return mobile ? <Mobile {...res}>{children}</Mobile> : <Desktop {...res}>{children}</Desktop>;
27
18
  },
28
19
  );
29
20
 
@@ -7,10 +7,15 @@ interface ServerResponsiveLayoutProps extends Record<string, any> {
7
7
  Mobile: (props: any) => ReactNode;
8
8
  children?: ReactNode;
9
9
  }
10
- const ResponsiveLayout = ({ children, Desktop, Mobile, ...res }: ServerResponsiveLayoutProps) => {
10
+ const ServerResponsiveLayout = ({
11
+ children,
12
+ Desktop,
13
+ Mobile,
14
+ ...res
15
+ }: ServerResponsiveLayoutProps) => {
11
16
  const mobile = isMobileDevice();
12
17
 
13
18
  return mobile ? <Mobile {...res}>{children}</Mobile> : <Desktop {...res}>{children}</Desktop>;
14
19
  };
15
20
 
16
- export default ResponsiveLayout;
21
+ export default ServerResponsiveLayout;
@@ -1,26 +0,0 @@
1
- 'use client';
2
-
3
- import { FC, ReactNode, Suspense } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
-
6
- import FullscreenLoading from '@/components/FullscreenLoading';
7
- import { useIsMobile } from '@/hooks/useIsMobile';
8
-
9
- interface ResponsiveIndexProps {
10
- Mobile: FC;
11
- children: ReactNode;
12
- }
13
- const ResponsiveIndex = ({ children, Mobile }: ResponsiveIndexProps) => {
14
- const { t } = useTranslation();
15
- const mobile = useIsMobile();
16
-
17
- return mobile ? (
18
- <Suspense fallback={<FullscreenLoading title={t('layoutInitializing', { ns: 'common' })} />}>
19
- <Mobile />
20
- </Suspense>
21
- ) : (
22
- children
23
- );
24
- };
25
-
26
- export default ResponsiveIndex;