@lobehub/chat 0.142.3 → 0.142.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/package.json +1 -1
  3. package/src/app/chat/(desktop)/features/ChatHeader/HeaderAction.tsx +2 -2
  4. package/src/app/chat/(desktop)/index.tsx +12 -23
  5. package/src/app/chat/(mobile)/features/SessionHeader.tsx +2 -0
  6. package/src/app/chat/(mobile)/index.tsx +4 -7
  7. package/src/app/chat/(mobile)/{features/ChatHeader.tsx → mobile/ChatHeader/index.tsx} +2 -2
  8. package/src/app/chat/(mobile)/mobile/page.tsx +6 -4
  9. package/src/app/chat/{(desktop)/features → _layout/Desktop}/SessionList.tsx +2 -0
  10. package/src/app/chat/{(desktop)/layout.desktop.tsx → _layout/Desktop/index.tsx} +7 -6
  11. package/src/app/chat/_layout/Mobile/index.tsx +7 -0
  12. package/src/app/chat/components/SessionHydration/index.tsx +1 -6
  13. package/src/app/chat/features/SessionListContent/Inbox/index.tsx +4 -11
  14. package/src/app/chat/features/SessionListContent/List/index.tsx +2 -14
  15. package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/Preview.tsx +1 -1
  16. package/src/app/chat/layout.ts +8 -0
  17. package/src/app/chat/page.tsx +2 -0
  18. package/src/app/chat/settings/(desktop)/index.tsx +13 -19
  19. package/src/app/chat/settings/(mobile)/{features/Header.tsx → Header.tsx} +4 -1
  20. package/src/app/chat/settings/(mobile)/index.tsx +4 -3
  21. package/src/app/home/Redirect.tsx +0 -4
  22. package/src/app/layout.tsx +7 -12
  23. package/src/app/market/(desktop)/index.tsx +8 -16
  24. package/src/app/market/(mobile)/index.tsx +12 -7
  25. package/src/app/market/_layout/Desktop/index.tsx +59 -0
  26. package/src/app/market/_layout/Mobile/Header.tsx +20 -0
  27. package/src/app/market/_layout/Mobile/index.tsx +14 -0
  28. package/src/app/market/layout.ts +8 -0
  29. package/src/app/settings/(desktop)/index.tsx +8 -10
  30. package/src/app/settings/(mobile)/index.tsx +53 -1
  31. package/src/app/settings/{(desktop)/features → _layout/Desktop}/Header.tsx +8 -3
  32. package/src/app/settings/{(desktop)/features → _layout/Desktop}/SideBar.tsx +8 -3
  33. package/src/app/settings/_layout/Desktop/index.tsx +27 -0
  34. package/src/app/settings/{(mobile)/features/Header/index.tsx → _layout/Mobile/SubSettingHeader.tsx} +9 -8
  35. package/src/app/settings/_layout/Mobile/index.tsx +23 -0
  36. package/src/app/settings/layout.ts +8 -0
  37. package/src/app/settings/page.tsx +4 -2
  38. package/src/app/welcome/(desktop)/index.tsx +9 -17
  39. package/src/app/welcome/(mobile)/index.tsx +12 -6
  40. package/src/app/welcome/_layout/Desktop.tsx +29 -0
  41. package/src/app/welcome/_layout/Mobile.tsx +9 -0
  42. package/src/app/welcome/features/Banner/index.tsx +1 -3
  43. package/src/app/welcome/layout.ts +8 -0
  44. package/src/components/client/ClientResponsiveContent/index.tsx +32 -0
  45. package/src/components/client/ClientResponsiveLayout.tsx +32 -0
  46. package/src/components/server/ServerLayout.tsx +20 -0
  47. package/src/features/AvatarWithUpload/index.tsx +12 -9
  48. package/src/features/MobileSwitchLoading/index.tsx +2 -0
  49. package/src/hooks/useActiveSettingsKey.ts +16 -0
  50. package/src/hooks/useActiveTabKey.ts +12 -0
  51. package/src/hooks/useIsMobile.ts +2 -1
  52. package/src/hooks/useIsSubSlug.ts +12 -0
  53. package/src/layout/AuthProvider/index.tsx +16 -0
  54. package/src/layout/{AppLayout.desktop.tsx → GlobalLayout/Desktop/Client.tsx} +11 -9
  55. package/src/layout/GlobalLayout/Desktop/index.tsx +16 -0
  56. package/src/layout/{AppLayout.mobile.tsx → GlobalLayout/Mobile/Client.tsx} +2 -16
  57. package/src/layout/GlobalLayout/Mobile/index.tsx +25 -0
  58. package/src/layout/GlobalLayout/index.tsx +8 -0
  59. package/src/store/session/slices/session/action.test.ts +0 -35
  60. package/src/store/session/slices/session/action.ts +8 -21
  61. package/src/store/session/slices/session/initialState.ts +0 -7
  62. package/src/styles/mobileHeader.ts +7 -0
  63. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +0 -18
  64. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +0 -9
  65. package/src/app/market/(desktop)/layout.desktop.tsx +0 -65
  66. package/src/app/market/(mobile)/features/Header.tsx +0 -10
  67. package/src/app/market/(mobile)/layout.mobile.tsx +0 -25
  68. package/src/app/settings/(desktop)/layout.desktop.tsx +0 -35
  69. package/src/app/settings/(desktop)/layout.responsive.tsx +0 -21
  70. package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
  71. package/src/app/settings/(mobile)/layout.mobile.tsx +0 -21
  72. package/src/app/settings/(mobile)/mobile/index.tsx +0 -54
  73. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
  74. package/src/app/settings/about/layout.tsx +0 -9
  75. package/src/app/settings/agent/layout.tsx +0 -9
  76. package/src/app/settings/common/layout.tsx +0 -9
  77. package/src/app/settings/layout.server.tsx +0 -19
  78. package/src/app/settings/llm/layout.tsx +0 -9
  79. package/src/app/settings/sync/layout.tsx +0 -9
  80. package/src/app/settings/tts/layout.tsx +0 -9
  81. package/src/app/welcome/(desktop)/layout.desktop.tsx +0 -31
  82. package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
  83. package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
  84. package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
  85. package/src/components/ResponsiveContainer/index.tsx +0 -20
  86. package/src/layout/ServerResponsiveLayout/Client.tsx +0 -23
  87. package/src/layout/ServerResponsiveLayout/index.tsx +0 -21
  88. /package/src/app/chat/(mobile)/{features → mobile/ChatHeader}/ChatHeaderTitle.tsx +0 -0
  89. /package/src/app/chat/{(desktop)/features → _layout/Desktop}/SessionHeader.tsx +0 -0
  90. /package/src/app/chat/features/{ChatHeader/SettingButton.tsx → SettingButton.tsx} +0 -0
  91. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/ShareModal.tsx +0 -0
  92. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/index.tsx +0 -0
  93. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/style.ts +0 -0
  94. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/type.ts +0 -0
  95. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/useScreenshot.ts +0 -0
  96. /package/src/app/chat/settings/(desktop)/{features/Header.tsx → Header.tsx} +0 -0
  97. /package/src/app/market/{(desktop)/features → _layout/Desktop}/AgentDetail.tsx +0 -0
  98. /package/src/app/market/{(desktop)/features → _layout/Desktop}/Header.tsx +0 -0
  99. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/BottomActions.tsx +0 -0
  100. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/TopActions.tsx +0 -0
  101. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/index.tsx +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.142.5](https://github.com/lobehub/lobe-chat/compare/v0.142.4...v0.142.5)
6
+
7
+ <sup>Released on **2024-03-26**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix mobile click, fix mobile click issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix mobile click ([3775b28](https://github.com/lobehub/lobe-chat/commit/3775b28))
21
+ - **misc**: Fix mobile click issue, closes [#1744](https://github.com/lobehub/lobe-chat/issues/1744) ([a6b1234](https://github.com/lobehub/lobe-chat/commit/a6b1234))
22
+
23
+ </details>
24
+
25
+ <div align="right">
26
+
27
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
28
+
29
+ </div>
30
+
31
+ ### [Version 0.142.4](https://github.com/lobehub/lobe-chat/compare/v0.142.3...v0.142.4)
32
+
33
+ <sup>Released on **2024-03-26**</sup>
34
+
35
+ <br/>
36
+
37
+ <details>
38
+ <summary><kbd>Improvements and Fixes</kbd></summary>
39
+
40
+ </details>
41
+
42
+ <div align="right">
43
+
44
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
45
+
46
+ </div>
47
+
5
48
  ### [Version 0.142.3](https://github.com/lobehub/lobe-chat/compare/v0.142.2...v0.142.3)
6
49
 
7
50
  <sup>Released on **2024-03-26**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.142.3",
3
+ "version": "0.142.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",
@@ -6,8 +6,8 @@ import { useTranslation } from 'react-i18next';
6
6
  import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
7
7
  import { useGlobalStore } from '@/store/global';
8
8
 
9
- import SettingButton from '../../../features/ChatHeader/SettingButton';
10
- import ShareButton from '../../../features/ChatHeader/ShareButton';
9
+ import SettingButton from '../../../features/SettingButton';
10
+ import ShareButton from '../../../features/ShareButton';
11
11
 
12
12
  const HeaderAction = memo(() => {
13
13
  const { t } = useTranslation('chat');
@@ -1,33 +1,22 @@
1
1
  'use client';
2
2
 
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
3
+ import { memo } from 'react';
5
4
  import { Flexbox } from 'react-layout-kit';
6
5
 
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
9
7
 
10
- import PageTitle from '../features/PageTitle';
11
8
  import ChatHeader from './features/ChatHeader';
12
9
  import Conversation from './features/Conversation';
13
10
  import SideBar from './features/SideBar';
14
- import Layout from './layout.desktop';
15
11
 
16
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
17
- loading: MobileSwitchLoading,
18
- ssr: false,
19
- }) as FC;
20
-
21
- const DesktopPage = memo(() => (
22
- <ResponsiveContainer Mobile={Mobile}>
23
- <Layout>
24
- <PageTitle />
25
- <ChatHeader />
26
- <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
27
- <Conversation />
28
- <SideBar />
29
- </Flexbox>
30
- </Layout>
31
- </ResponsiveContainer>
12
+ const Desktop = memo(() => (
13
+ <>
14
+ <ChatHeader />
15
+ <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
16
+ <Conversation />
17
+ <SideBar />
18
+ </Flexbox>
19
+ </>
32
20
  ));
33
- export default DesktopPage;
21
+
22
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -10,6 +10,7 @@ import SyncStatusInspector from '@/features/SyncStatusInspector';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
  import { commonSelectors } from '@/store/global/selectors';
12
12
  import { useSessionStore } from '@/store/session';
13
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
13
14
 
14
15
  export const useStyles = createStyles(({ css, token }) => ({
15
16
  logo: css`
@@ -43,6 +44,7 @@ const Header = memo(() => {
43
44
  size={MOBILE_HEADER_ICON_SIZE}
44
45
  />
45
46
  }
47
+ style={mobileHeaderSticky}
46
48
  />
47
49
  );
48
50
  });
@@ -3,25 +3,22 @@
3
3
  import { useRouter } from 'next/navigation';
4
4
  import { memo, useEffect } from 'react';
5
5
 
6
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
7
- import { SidebarTabKey } from '@/store/global/initialState';
8
-
9
- import PageTitle from '../features/PageTitle';
10
6
  import SessionHeader from './features/SessionHeader';
11
7
  import SessionList from './features/SessionList';
12
8
 
13
9
  const ChatMobilePage = memo(() => {
14
10
  const router = useRouter();
11
+
15
12
  useEffect(() => {
16
13
  router.prefetch('/chat/mobile');
17
14
  router.prefetch('/settings');
18
15
  }, []);
19
16
 
20
17
  return (
21
- <AppLayoutMobile navBar={<SessionHeader />} showTabBar tabBarKey={SidebarTabKey.Chat}>
22
- <PageTitle />
18
+ <>
19
+ <SessionHeader />
23
20
  <SessionList />
24
- </AppLayoutMobile>
21
+ </>
25
22
  );
26
23
  });
27
24
 
@@ -2,8 +2,8 @@ import { MobileNavBar } from '@lobehub/ui';
2
2
  import { useRouter } from 'next/navigation';
3
3
  import { memo, useState } from 'react';
4
4
 
5
- import SettingButton from '../../features/ChatHeader/SettingButton';
6
- import ShareButton from '../../features/ChatHeader/ShareButton';
5
+ import SettingButton from '../../../features/SettingButton';
6
+ import ShareButton from '../../../features/ShareButton';
7
7
  import ChatHeaderTitle from './ChatHeaderTitle';
8
8
 
9
9
  const MobileHeader = memo(() => {
@@ -4,13 +4,13 @@ import dynamic from 'next/dynamic';
4
4
  import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
- import ChatHeader from '@/app/chat/(mobile)/features/ChatHeader';
8
7
  import Conversation from '@/features/Conversation';
9
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
10
8
  import { useSessionStore } from '@/store/session';
11
9
 
10
+ import SessionHydration from '../../components/SessionHydration';
12
11
  import TelemetryNotification from '../../features/TelemetryNotification';
13
12
  import ChatInput from '../features/ChatInput';
13
+ import ChatHeader from './ChatHeader';
14
14
 
15
15
  const TopicList = dynamic(() => import('../features/TopicList'));
16
16
 
@@ -21,13 +21,15 @@ const Chat = memo(() => {
21
21
  useFetchSessions();
22
22
 
23
23
  return (
24
- <AppLayoutMobile navBar={<ChatHeader />}>
24
+ <>
25
+ <ChatHeader />
25
26
  <Flexbox height={'calc(100% - 44px)'} horizontal>
26
27
  <Conversation chatInput={<ChatInput />} mobile />
27
28
  <TopicList />
28
29
  <TelemetryNotification mobile />
29
30
  </Flexbox>
30
- </AppLayoutMobile>
31
+ <SessionHydration />
32
+ </>
31
33
  );
32
34
  });
33
35
  export default Chat;
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { DraggablePanelBody } from '@lobehub/ui';
2
4
  import { createStyles } from 'antd-style';
3
5
  import { memo } from 'react';
@@ -3,14 +3,13 @@
3
3
  import { PropsWithChildren, memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
7
- import { SidebarTabKey } from '@/store/global/initialState';
6
+ import ClientResponsiveLayout from '@/components/client/ClientResponsiveLayout';
8
7
 
9
- import ResponsiveSessionList from './features/SessionList';
8
+ import ResponsiveSessionList from './SessionList';
10
9
 
11
- export default memo(({ children }: PropsWithChildren) => {
10
+ const Desktop = memo(({ children }: PropsWithChildren) => {
12
11
  return (
13
- <AppLayoutDesktop sidebarKey={SidebarTabKey.Chat}>
12
+ <>
14
13
  <ResponsiveSessionList />
15
14
  <Flexbox
16
15
  flex={1}
@@ -20,6 +19,8 @@ export default memo(({ children }: PropsWithChildren) => {
20
19
  >
21
20
  {children}
22
21
  </Flexbox>
23
- </AppLayoutDesktop>
22
+ </>
24
23
  );
25
24
  });
25
+
26
+ export default ClientResponsiveLayout({ Desktop, Mobile: () => import('../Mobile') });
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ const MobileLayout = ({ children }: PropsWithChildren) => {
4
+ return children;
5
+ };
6
+
7
+ export default MobileLayout;
@@ -1,9 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { useResponsive } from 'antd-style';
4
- import { useRouter } from 'next/navigation';
5
4
  import { useQueryState } from 'nuqs';
6
- import { parseAsString } from 'nuqs/parsers';
5
+ import { parseAsString } from 'nuqs/server';
7
6
  import { memo, useEffect } from 'react';
8
7
  import { createStoreUpdater } from 'zustand-utils';
9
8
 
@@ -16,10 +15,6 @@ const SessionHydration = memo(() => {
16
15
  const { mobile } = useResponsive();
17
16
  useStoreUpdater('isMobile', mobile);
18
17
 
19
- const router = useRouter();
20
- // TODO: 后续可以把 router 从 useSessionStore 移除
21
- useStoreUpdater('router', router);
22
-
23
18
  // two-way bindings the url and session store
24
19
  const [session, setSession] = useQueryState(
25
20
  'session',
@@ -1,4 +1,3 @@
1
- import { useResponsive } from 'antd-style';
2
1
  import Link from 'next/link';
3
2
  import { memo } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
@@ -6,24 +5,18 @@ import { useTranslation } from 'react-i18next';
6
5
  import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
7
6
  import { INBOX_SESSION_ID } from '@/const/session';
8
7
  import { SESSION_CHAT_URL } from '@/const/url';
8
+ import { useIsMobile } from '@/hooks/useIsMobile';
9
9
  import { useSessionStore } from '@/store/session';
10
10
 
11
11
  import ListItem from '../ListItem';
12
12
 
13
13
  const Inbox = memo(() => {
14
14
  const { t } = useTranslation('chat');
15
- const { mobile } = useResponsive();
16
- const [activeId, switchSession] = useSessionStore((s) => [s.activeId, s.switchSession]);
15
+ const mobile = useIsMobile();
16
+ const activeId = useSessionStore((s) => s.activeId);
17
17
 
18
18
  return (
19
- <Link
20
- aria-label={t('inbox.title')}
21
- href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}
22
- onClick={(e) => {
23
- e.preventDefault();
24
- switchSession(INBOX_SESSION_ID);
25
- }}
26
- >
19
+ <Link aria-label={t('inbox.title')} href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}>
27
20
  <ListItem
28
21
  active={activeId === INBOX_SESSION_ID}
29
22
  avatar={DEFAULT_INBOX_AVATAR}
@@ -24,11 +24,7 @@ interface SessionListProps {
24
24
  showAddButton?: boolean;
25
25
  }
26
26
  const SessionList = memo<SessionListProps>(({ dataSource, groupId, showAddButton = true }) => {
27
- const [activeSession, switchSession, isInit] = useSessionStore((s) => [
28
- s.activeSession,
29
- s.switchSession,
30
- sessionSelectors.isSessionListInit(s),
31
- ]);
27
+ const isInit = useSessionStore((s) => sessionSelectors.isSessionListInit(s));
32
28
  const { styles } = useStyles();
33
29
 
34
30
  const { mobile } = useResponsive();
@@ -38,15 +34,7 @@ const SessionList = memo<SessionListProps>(({ dataSource, groupId, showAddButton
38
34
  ) : dataSource.length > 0 ? (
39
35
  dataSource.map(({ id }) => (
40
36
  <LazyLoad className={styles} key={id}>
41
- <Link
42
- aria-label={id}
43
- href={SESSION_CHAT_URL(id, mobile)}
44
- onClick={(e) => {
45
- e.preventDefault();
46
- if (mobile) switchSession(id);
47
- else activeSession(id);
48
- }}
49
- >
37
+ <Link aria-label={id} href={SESSION_CHAT_URL(id, mobile)}>
50
38
  <SessionItem id={id} />
51
39
  </Link>
52
40
  </LazyLoad>
@@ -9,7 +9,7 @@ import ChatList from '@/features/Conversation/components/ChatList';
9
9
  import { useSessionStore } from '@/store/session';
10
10
  import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
11
11
 
12
- import PluginTag from '../../PluginTag';
12
+ import PluginTag from '../PluginTag';
13
13
  import { useStyles } from './style';
14
14
  import { FieldType } from './type';
15
15
 
@@ -0,0 +1,8 @@
1
+ import ServerLayout from '@/components/server/ServerLayout';
2
+
3
+ import Desktop from './_layout/Desktop';
4
+ import Mobile from './_layout/Mobile';
5
+
6
+ const ChatLayout = ServerLayout({ Desktop, Mobile });
7
+
8
+ export default ChatLayout;
@@ -4,6 +4,7 @@ import DesktopPage from './(desktop)';
4
4
  import MobilePage from './(mobile)';
5
5
  import SessionHydration from './components/SessionHydration';
6
6
  import Migration from './features/Migration';
7
+ import PageTitle from './features/PageTitle';
7
8
 
8
9
  const Page = () => {
9
10
  const mobile = isMobileDevice();
@@ -13,6 +14,7 @@ const Page = () => {
13
14
  return (
14
15
  <>
15
16
  <Migration>
17
+ <PageTitle />
16
18
  <Page />
17
19
  </Migration>
18
20
  <SessionHydration />
@@ -1,29 +1,23 @@
1
1
  'use client';
2
2
 
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
3
+ import { memo } from 'react';
4
+ import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import SessionHydration from '@/app/chat/components/SessionHydration';
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import SafeSpacing from '@/components/SafeSpacing';
7
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
8
+ import { HEADER_HEIGHT } from '@/const/layoutTokens';
9
9
 
10
10
  import EditPage from '../features/EditPage';
11
- import Layout from './layout.desktop';
11
+ import Header from './Header';
12
12
 
13
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
14
- loading: MobileSwitchLoading,
15
- ssr: false,
16
- }) as FC;
17
-
18
- const ChatSettings = memo(() => (
13
+ const Desktop = memo(() => (
19
14
  <>
20
- <ResponsiveContainer Mobile={Mobile}>
21
- <Layout>
22
- <EditPage />
23
- </Layout>
24
- </ResponsiveContainer>
25
- <SessionHydration />
15
+ <Header />
16
+ <Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'scroll' }}>
17
+ <SafeSpacing height={HEADER_HEIGHT - 16} />
18
+ <EditPage />
19
+ </Flexbox>
26
20
  </>
27
21
  ));
28
22
 
29
- export default ChatSettings;
23
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -3,9 +3,11 @@ import { useRouter } from 'next/navigation';
3
3
  import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
- import HeaderContent from '@/app/chat/settings/features/HeaderContent';
6
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
7
7
  import { pathString } from '@/utils/url';
8
8
 
9
+ import HeaderContent from '../features/HeaderContent';
10
+
9
11
  const Header = memo(() => {
10
12
  const { t } = useTranslation('setting');
11
13
  const router = useRouter();
@@ -16,6 +18,7 @@ const Header = memo(() => {
16
18
  onBackClick={() => router.push(pathString('/chat/mobile', { search: location.search }))}
17
19
  right={<HeaderContent />}
18
20
  showBackButton
21
+ style={mobileHeaderSticky}
19
22
  />
20
23
  );
21
24
  });
@@ -3,12 +3,13 @@
3
3
  import { memo } from 'react';
4
4
 
5
5
  import EditPage from '../features/EditPage';
6
- import Layout from './layout.mobile';
6
+ import Header from './Header';
7
7
 
8
8
  const ChatSettings = memo(() => (
9
- <Layout>
9
+ <>
10
+ <Header />
10
11
  <EditPage />
11
- </Layout>
12
+ </>
12
13
  ));
13
14
 
14
15
  export default ChatSettings;
@@ -5,7 +5,6 @@ import { memo, useEffect } from 'react';
5
5
 
6
6
  import { messageService } from '@/services/message';
7
7
  import { sessionService } from '@/services/session';
8
- import { useSessionStore } from '@/store/session';
9
8
 
10
9
  const checkHasConversation = async () => {
11
10
  const hasMessages = await messageService.hasMessages();
@@ -15,14 +14,11 @@ const checkHasConversation = async () => {
15
14
 
16
15
  const Redirect = memo(() => {
17
16
  const router = useRouter();
18
- const [switchSession] = useSessionStore((s) => [s.switchSession]);
19
17
 
20
18
  useEffect(() => {
21
19
  checkHasConversation().then((hasData) => {
22
20
  if (hasData) {
23
21
  router.replace('/chat');
24
-
25
- switchSession();
26
22
  } else {
27
23
  router.replace('/welcome');
28
24
  }
@@ -1,35 +1,30 @@
1
1
  import { SpeedInsights } from '@vercel/speed-insights/next';
2
2
  import { ResolvingViewport } from 'next';
3
- import { SessionProvider } from 'next-auth/react';
4
3
  import { cookies } from 'next/headers';
5
4
  import { PropsWithChildren } from 'react';
6
5
  import { isRtlLang } from 'rtl-detect';
7
6
 
8
7
  import Analytics from '@/components/Analytics';
9
- import { getServerConfig } from '@/config/server';
10
8
  import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
9
+ import AuthProvider from '@/layout/AuthProvider';
10
+ import GlobalLayout from '@/layout/GlobalLayout';
11
11
  import GlobalProvider from '@/layout/GlobalProvider';
12
- import { API_ENDPOINTS } from '@/services/_url';
13
12
  import { isMobileDevice } from '@/utils/responsive';
14
13
 
15
- const { ENABLE_OAUTH_SSO = false } = getServerConfig();
16
-
17
14
  const RootLayout = async ({ children }: PropsWithChildren) => {
18
15
  const cookieStore = cookies();
19
16
 
20
17
  const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
21
18
  const direction = isRtlLang(lang?.value || DEFAULT_LANG) ? 'rtl' : 'ltr';
22
19
 
23
- const content = ENABLE_OAUTH_SSO ? (
24
- <SessionProvider basePath={API_ENDPOINTS.oauth}>{children}</SessionProvider>
25
- ) : (
26
- children
27
- );
28
-
29
20
  return (
30
21
  <html dir={direction} lang={lang?.value || DEFAULT_LANG} suppressHydrationWarning>
31
22
  <body>
32
- <GlobalProvider>{content}</GlobalProvider>
23
+ <GlobalProvider>
24
+ <AuthProvider>
25
+ <GlobalLayout>{children}</GlobalLayout>
26
+ </AuthProvider>
27
+ </GlobalProvider>
33
28
  <Analytics />
34
29
  <SpeedInsights />
35
30
  </body>
@@ -1,26 +1,18 @@
1
1
  'use client';
2
2
 
3
3
  import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
4
- import dynamic from 'next/dynamic';
5
4
  import { FC, memo } from 'react';
6
5
 
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
9
7
 
10
8
  import AgentCard from '../features/AgentCard';
11
9
  import Index from '../index';
12
- import Layout from './layout.desktop';
13
10
 
14
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
15
- loading: MobileSwitchLoading,
16
- ssr: false,
17
- }) as FC;
18
-
19
- export default memo(() => (
20
- <ResponsiveContainer Mobile={Mobile}>
21
- <Layout>
22
- <Index />
23
- <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
24
- </Layout>
25
- </ResponsiveContainer>
11
+ const Desktop = memo(() => (
12
+ <>
13
+ <Index />
14
+ <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
15
+ </>
26
16
  ));
17
+
18
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -1,16 +1,21 @@
1
1
  'use client';
2
2
 
3
+ import dynamic from 'next/dynamic';
3
4
  import { memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
4
6
 
5
- import AgentCard from '@/app/market/features/AgentCard';
6
-
7
+ import AgentCard from '../features/AgentCard';
7
8
  import Index from '../index';
8
9
  import CardRender from './features/AgentCard';
9
- import Layout from './layout.mobile';
10
+
11
+ const DetailModal = dynamic(() => import('./features/AgentDetail'), { ssr: false });
10
12
 
11
13
  export default memo(() => (
12
- <Layout>
13
- <Index />
14
- <AgentCard CardRender={CardRender} mobile />
15
- </Layout>
14
+ <>
15
+ <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
16
+ <Index />
17
+ <AgentCard CardRender={CardRender} mobile />{' '}
18
+ </Flexbox>
19
+ <DetailModal />
20
+ </>
16
21
  ));
@@ -0,0 +1,59 @@
1
+ 'use client';
2
+
3
+ import { GridBackground } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import dynamic from 'next/dynamic';
6
+ import { PropsWithChildren, memo } from 'react';
7
+ import { Center, Flexbox } from 'react-layout-kit';
8
+
9
+ import SafeSpacing from '@/components/SafeSpacing';
10
+ import ClientResponsiveLayout from '@/components/client/ClientResponsiveLayout';
11
+ import { MAX_WIDTH } from '@/const/layoutTokens';
12
+
13
+ import Header from './Header';
14
+
15
+ const SideBar = dynamic(() => import('./AgentDetail'));
16
+
17
+ const useStyles = createStyles(({ css }) => ({
18
+ background: css`
19
+ width: 80%;
20
+ margin: -60px 0 -20px;
21
+ `,
22
+ title: css`
23
+ z-index: 2;
24
+ margin-top: 24px;
25
+ font-size: 56px;
26
+ font-weight: 800;
27
+ `,
28
+ }));
29
+
30
+ const Desktop = memo<PropsWithChildren>(({ children }) => {
31
+ const { theme, styles } = useStyles();
32
+
33
+ return (
34
+ <Flexbox flex={1} height={'100%'} id={'lobe-market-container'} style={{ position: 'relative' }}>
35
+ <Header />
36
+ <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
37
+ <Flexbox align={'center'} flex={1} style={{ overflow: 'scroll', padding: 16 }}>
38
+ <SafeSpacing />
39
+
40
+ <Flexbox gap={16} style={{ maxWidth: MAX_WIDTH, position: 'relative', width: '100%' }}>
41
+ <Center>
42
+ <h1 className={styles.title}>Find & Use The Best Agents</h1>
43
+ <GridBackground
44
+ animation
45
+ className={styles.background}
46
+ colorFront={theme.colorText}
47
+ random
48
+ />
49
+ </Center>
50
+ {children}
51
+ </Flexbox>
52
+ </Flexbox>
53
+ <SideBar />
54
+ </Flexbox>
55
+ </Flexbox>
56
+ );
57
+ });
58
+
59
+ export default ClientResponsiveLayout({ Desktop, Mobile: () => import('../Mobile') });