@lobehub/chat 0.83.10 → 0.84.0-beta.2

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 (152) hide show
  1. package/.dockerignore +10 -0
  2. package/.github/workflows/release.yml +3 -0
  3. package/.releaserc.js +14 -1
  4. package/CHANGELOG.md +27 -14
  5. package/Dockerfile +47 -0
  6. package/next.config.mjs +3 -0
  7. package/package.json +4 -2
  8. package/src/app/chat/(desktop)/features/{ChatHeader.tsx → ChatHeader/Desktop.tsx} +2 -2
  9. package/src/app/chat/(desktop)/features/ChatHeader/index.tsx +14 -0
  10. package/src/app/chat/(desktop)/features/{ChatInput.tsx → ChatInput/Desktop.tsx} +7 -5
  11. package/src/app/chat/(desktop)/features/ChatInput/index.tsx +22 -0
  12. package/src/app/chat/(desktop)/features/{SessionHeader.tsx → SessionHeader/Desktop.tsx} +1 -1
  13. package/src/app/chat/(desktop)/features/SessionHeader/index.tsx +14 -0
  14. package/src/app/chat/(desktop)/features/{SessionList.tsx → SessionList/Desktop.tsx} +4 -5
  15. package/src/app/chat/(desktop)/features/SessionList/index.tsx +20 -0
  16. package/src/app/chat/(desktop)/features/{SideBar.tsx → SideBar/Desktop.tsx} +4 -5
  17. package/src/app/chat/(desktop)/features/SideBar/index.tsx +20 -0
  18. package/src/app/chat/(desktop)/index.tsx +8 -14
  19. package/src/app/chat/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +8 -7
  20. package/src/app/chat/(desktop)/layout/index.tsx +25 -0
  21. package/src/app/chat/(mobile)/features/ChatHeader.tsx +1 -54
  22. package/src/app/chat/(mobile)/features/ChatInput.tsx +8 -28
  23. package/src/app/chat/(mobile)/features/SessionList.tsx +8 -13
  24. package/src/app/chat/(mobile)/features/Topics.tsx +12 -0
  25. package/src/app/chat/(mobile)/index.tsx +5 -3
  26. package/src/app/chat/(mobile)/layout.tsx +15 -0
  27. package/src/app/chat/(mobile)/mobile/page.tsx +20 -2
  28. package/src/app/chat/components/ChatHeader/Mobile.tsx +54 -0
  29. package/src/app/chat/{features → components}/ChatHeader/ShareButton/Preview.tsx +9 -25
  30. package/src/app/chat/{features → components}/ChatHeader/ShareButton/style.ts +7 -7
  31. package/src/app/chat/components/ChatInput/Mobile.tsx +35 -0
  32. package/src/app/chat/{features/ChatInputContent → components/ChatInput}/index.tsx +1 -3
  33. package/src/app/chat/{(mobile)/features/TopicList.tsx → components/Inspector/Mobile.tsx} +4 -6
  34. package/src/app/chat/{features/TopicListContent → components/Inspector}/index.tsx +1 -3
  35. package/src/app/chat/{features/SessionListContent → components/SessionList}/Inbox/index.tsx +5 -7
  36. package/src/app/chat/components/SessionList/Mobile.tsx +16 -0
  37. package/src/app/chat/{features/SessionListContent → components/SessionList}/index.tsx +1 -3
  38. package/src/app/chat/layout.tsx +15 -0
  39. package/src/app/chat/page.tsx +1 -3
  40. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +15 -10
  41. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +8 -4
  42. package/src/app/chat/settings/layout.tsx +14 -0
  43. package/src/app/chat/settings/page.tsx +33 -9
  44. package/src/app/market/(desktop)/{features/AgentDetail.tsx → AgentDetail/Desktop.tsx} +3 -5
  45. package/src/app/market/(desktop)/AgentDetail/index.tsx +16 -0
  46. package/src/app/market/(desktop)/Header/index.tsx +13 -0
  47. package/src/app/market/(desktop)/{layout.desktop.tsx → layout/Desktop.tsx} +5 -5
  48. package/src/app/market/(desktop)/layout/index.tsx +17 -0
  49. package/src/app/market/(mobile)/AgentDetail.tsx +12 -0
  50. package/src/app/market/(mobile)/layout.mobile.tsx +5 -5
  51. package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Header.tsx +0 -1
  52. package/src/app/market/{(mobile)/features/AgentDetail.tsx → components/AgentDetail/Mobile.tsx} +4 -6
  53. package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/index.tsx +1 -3
  54. package/src/app/market/features/TagList/index.tsx +1 -2
  55. package/src/app/market/layout.tsx +13 -0
  56. package/src/app/market/page.tsx +5 -8
  57. package/src/app/settings/agent/page.tsx +31 -2
  58. package/src/app/settings/common/page.tsx +14 -2
  59. package/src/app/settings/{(desktop)/features/Header.tsx → features/Header/Desktop.tsx} +2 -2
  60. package/src/app/settings/{(mobile)/features/Header/index.tsx → features/Header/Mobile.tsx} +0 -1
  61. package/src/app/settings/features/Header/index.tsx +14 -0
  62. package/src/app/settings/{(desktop)/layout.desktop.tsx → layout.desktop/Desktop.tsx} +9 -10
  63. package/src/app/settings/layout.desktop/index.tsx +32 -0
  64. package/src/app/settings/layout.mobile.tsx +16 -0
  65. package/src/app/settings/layout.tsx +15 -0
  66. package/src/app/settings/llm/page.tsx +14 -2
  67. package/src/app/settings/{(mobile)/features → mobile}/ExtraList.tsx +1 -1
  68. package/src/app/settings/{(mobile)/mobile → mobile}/index.tsx +7 -7
  69. package/src/app/settings/mobile/page.tsx +7 -0
  70. package/src/app/settings/page.tsx +1 -14
  71. package/src/app/welcome/{(desktop)/layout.desktop.tsx → DesktopLayout/Desktop.tsx} +4 -4
  72. package/src/app/welcome/DesktopLayout/index.tsx +15 -0
  73. package/src/app/welcome/MobileLayout.tsx +23 -0
  74. package/src/app/welcome/features/Banner/Hero.tsx +3 -2
  75. package/src/app/welcome/features/Banner/index.tsx +31 -34
  76. package/src/app/welcome/features/Banner/style.ts +1 -10
  77. package/src/app/welcome/layout.tsx +22 -0
  78. package/src/app/welcome/page.tsx +7 -9
  79. package/src/{layout/ResponsiveLayout.server.tsx → components/ResponsiveLayout.tsx} +3 -4
  80. package/src/features/MobileTabBar/index.tsx +1 -1
  81. package/src/features/SideBar/BottomActions.tsx +1 -1
  82. package/src/layout/{AppLayout.desktop.tsx → AppLayout.tsx} +2 -2
  83. package/src/layout/{AppLayout.mobile.tsx → AppMobileLayout.tsx} +2 -2
  84. package/src/layout/GlobalLayout/StoreHydration.tsx +1 -15
  85. package/src/store/session/slices/session/initialState.ts +2 -2
  86. package/src/app/chat/(desktop)/layout.responsive.tsx +0 -12
  87. package/src/app/chat/(mobile)/layout.mobile.tsx +0 -17
  88. package/src/app/chat/(mobile)/mobile/index.tsx +0 -19
  89. package/src/app/chat/(mobile)/mobile/layout.mobile.tsx +0 -11
  90. package/src/app/chat/settings/(desktop)/index.tsx +0 -14
  91. package/src/app/chat/settings/(desktop)/layout.responsive.tsx +0 -12
  92. package/src/app/chat/settings/(mobile)/index.tsx +0 -14
  93. package/src/app/chat/settings/features/EditPage.tsx +0 -38
  94. package/src/app/market/(desktop)/index.tsx +0 -12
  95. package/src/app/market/(desktop)/layout.responsive.tsx +0 -16
  96. package/src/app/market/(mobile)/index.tsx +0 -12
  97. package/src/app/settings/(desktop)/index.tsx +0 -17
  98. package/src/app/settings/(desktop)/layout.responsive.tsx +0 -14
  99. package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
  100. package/src/app/settings/(mobile)/index.tsx +0 -3
  101. package/src/app/settings/(mobile)/layout.mobile.tsx +0 -19
  102. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
  103. package/src/app/settings/agent/Agent.tsx +0 -30
  104. package/src/app/settings/agent/index.tsx +0 -23
  105. package/src/app/settings/agent/layout.tsx +0 -1
  106. package/src/app/settings/common/index.tsx +0 -23
  107. package/src/app/settings/common/layout.tsx +0 -1
  108. package/src/app/settings/layout.server.tsx +0 -12
  109. package/src/app/settings/llm/index.tsx +0 -23
  110. package/src/app/settings/llm/layout.tsx +0 -1
  111. package/src/app/welcome/(desktop)/features/Showcase.tsx +0 -23
  112. package/src/app/welcome/(desktop)/index.tsx +0 -19
  113. package/src/app/welcome/(desktop)/layout.responsive.tsx +0 -14
  114. package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
  115. package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
  116. package/src/app/welcome/(mobile)/index.tsx +0 -10
  117. package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
  118. package/src/components/ResponsiveIndex.tsx +0 -17
  119. package/src/layout/ResponsiveLayout.client.tsx +0 -18
  120. /package/src/app/chat/{features → components}/ChatHeader/PluginTag/PluginStatus.tsx +0 -0
  121. /package/src/app/chat/{features → components}/ChatHeader/PluginTag/index.tsx +0 -0
  122. /package/src/app/chat/{features → components}/ChatHeader/ShareButton/Inner.tsx +0 -0
  123. /package/src/app/chat/{features → components}/ChatHeader/ShareButton/index.tsx +0 -0
  124. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionLeft.tsx +0 -0
  125. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/ActionRight.tsx +0 -0
  126. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/ActionBar/Token.tsx +0 -0
  127. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/SaveTopic.tsx +0 -0
  128. /package/src/app/chat/{features/ChatInputContent → components/ChatInput}/Footer/index.tsx +0 -0
  129. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/Header.tsx +0 -0
  130. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/index.tsx +0 -0
  131. /package/src/app/chat/{features/TopicListContent → components/Inspector}/SystemRole/style.ts +0 -0
  132. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/DefaultContent.tsx +0 -0
  133. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/SkeletonList.tsx +0 -0
  134. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicContent.tsx +0 -0
  135. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/TopicItem.tsx +0 -0
  136. /package/src/app/chat/{features/TopicListContent → components/Inspector}/Topic/index.tsx +0 -0
  137. /package/src/app/chat/{features/TopicListContent → components/Inspector}/TopicSearchBar/index.tsx +0 -0
  138. /package/src/app/chat/{features/SessionListContent → components/SessionList}/CollapseGroup/index.tsx +0 -0
  139. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/AddButton.tsx +0 -0
  140. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/Actions.tsx +0 -0
  141. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/Item/index.tsx +0 -0
  142. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/SkeletonList.tsx +0 -0
  143. /package/src/app/chat/{features/SessionListContent → components/SessionList}/List/index.tsx +0 -0
  144. /package/src/app/chat/features/{PageTitle/index.tsx → PageTitle.tsx} +0 -0
  145. /package/src/app/market/(desktop)/{features/Header.tsx → Header/Desktop.tsx} +0 -0
  146. /package/src/app/market/(mobile)/{features/Header.tsx → Header.tsx} +0 -0
  147. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Comment.tsx +0 -0
  148. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/Loading.tsx +0 -0
  149. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/TokenTag.tsx +0 -0
  150. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/index.tsx +0 -0
  151. /package/src/app/market/{features/AgentDetailContent → components/AgentDetail}/AgentInfo/style.ts +0 -0
  152. /package/src/app/welcome/{(desktop)/features/Footer.tsx → features/Footer/index.tsx} +0 -0
@@ -0,0 +1,12 @@
1
+ import { memo } from 'react';
2
+
3
+ import { AgentDetailContent } from '../components/AgentDetail';
4
+ import Mobile from '../components/AgentDetail/Mobile';
5
+
6
+ const AgentDetail = memo(() => (
7
+ <Mobile>
8
+ <AgentDetailContent />
9
+ </Mobile>
10
+ ));
11
+
12
+ export default AgentDetail;
@@ -3,23 +3,23 @@
3
3
  import { PropsWithChildren } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
6
+ import AppMobileLayout from '@/layout/AppMobileLayout';
7
7
  import { useSwitchSideBarOnInit } from '@/store/global';
8
8
  import { SidebarTabKey } from '@/store/global/initialState';
9
9
 
10
- import DetailModal from './features/AgentDetail';
11
- import Header from './features/Header';
10
+ import DetailModal from './AgentDetail';
11
+ import Header from './Header';
12
12
 
13
13
  const MarketLayout = ({ children }: PropsWithChildren) => {
14
14
  useSwitchSideBarOnInit(SidebarTabKey.Market);
15
15
 
16
16
  return (
17
- <AppLayoutMobile navBar={<Header />} showTabBar>
17
+ <AppMobileLayout navBar={<Header />} showTabBar>
18
18
  <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
19
19
  {children}
20
20
  </Flexbox>
21
21
  <DetailModal />
22
- </AppLayoutMobile>
22
+ </AppMobileLayout>
23
23
  );
24
24
  };
25
25
 
@@ -28,7 +28,6 @@ const Header = memo(() => {
28
28
  return (
29
29
  <Center className={styles.container} gap={16}>
30
30
  <Avatar
31
- animation
32
31
  avatar={avatar}
33
32
  background={backgroundColor || theme.colorFillTertiary}
34
33
  className={styles.avatar}
@@ -1,12 +1,10 @@
1
1
  import { Modal } from '@lobehub/ui';
2
- import { memo } from 'react';
2
+ import { PropsWithChildren, memo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import { agentMarketSelectors, useMarketStore } from '@/store/market';
6
6
 
7
- import AgentDetailContent from '../../features/AgentDetailContent';
8
-
9
- const AgentDetail = memo(() => {
7
+ const Mobile = memo<PropsWithChildren>(({ children }) => {
10
8
  const [showAgentSidebar, deactivateAgent] = useMarketStore((s) => [
11
9
  agentMarketSelectors.showSideBar(s),
12
10
  s.deactivateAgent,
@@ -16,9 +14,9 @@ const AgentDetail = memo(() => {
16
14
 
17
15
  return (
18
16
  <Modal onCancel={deactivateAgent} open={showAgentSidebar} title={t('sidebar.title')}>
19
- <AgentDetailContent />
17
+ {children}
20
18
  </Modal>
21
19
  );
22
20
  });
23
21
 
24
- export default AgentDetail;
22
+ export default Mobile;
@@ -3,10 +3,8 @@ import { Flexbox } from 'react-layout-kit';
3
3
 
4
4
  import AgentInfo from './AgentInfo';
5
5
 
6
- const AgentDetailContent = memo(() => (
6
+ export const AgentDetailContent = memo(() => (
7
7
  <Flexbox>
8
8
  <AgentInfo />
9
9
  </Flexbox>
10
10
  ));
11
-
12
- export default AgentDetailContent;
@@ -11,13 +11,12 @@ const TagList = memo(() => {
11
11
  const keywords = useMarketStore((s) => s.searchKeywords);
12
12
 
13
13
  return (
14
- <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
14
+ <Flexbox gap={8} horizontal style={{ flexWrap: 'wrap' }}>
15
15
  {agentTagList.map((item) => (
16
16
  <Button
17
17
  key={item}
18
18
  onClick={() => useMarketStore.setState({ searchKeywords: item })}
19
19
  shape={'round'}
20
- size={'small'}
21
20
  type={keywords === item ? 'primary' : 'default'}
22
21
  >
23
22
  {startCase(item)}
@@ -0,0 +1,13 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import ResponsiveLayout from '@/components/ResponsiveLayout';
4
+ import { isMobileDevice } from '@/utils/responsive';
5
+
6
+ import Desktop from './(desktop)/layout';
7
+ import Mobile from './(mobile)/layout.mobile';
8
+
9
+ export default ({ children }: PropsWithChildren) => (
10
+ <ResponsiveLayout Desktop={Desktop} Mobile={Mobile} isMobile={isMobileDevice}>
11
+ {children}
12
+ </ResponsiveLayout>
13
+ );
@@ -4,10 +4,8 @@ import { LOBE_LOCALE_COOKIE } from '@/const/locale';
4
4
  import { getAgentIndexJSON } from '@/const/url';
5
5
  import { Locales } from '@/locales/resources';
6
6
  import { LobeChatAgentsMarketIndex } from '@/types/market';
7
- import { isMobileDevice } from '@/utils/responsive';
8
7
 
9
- import DesktopPage from './(desktop)';
10
- import MobilePage from './(mobile)';
8
+ import Market from './index';
11
9
 
12
10
  const getAgentList = async (): Promise<LobeChatAgentsMarketIndex> => {
13
11
  const cookieStore = cookies();
@@ -22,11 +20,10 @@ const getAgentList = async (): Promise<LobeChatAgentsMarketIndex> => {
22
20
  }
23
21
  };
24
22
 
25
- export default async () => {
23
+ const Page = async () => {
26
24
  const data = await getAgentList();
27
- const mobile = isMobileDevice();
28
25
 
29
- const Page = mobile ? MobilePage : DesktopPage;
30
-
31
- return <Page defaultAgents={data.agents} />;
26
+ return <Market defaultAgents={data.agents} />;
32
27
  };
28
+
29
+ export default Page;
@@ -1,3 +1,32 @@
1
- import Index from './index';
1
+ 'use client';
2
2
 
3
- export default () => <Index />;
3
+ import isEqual from 'fast-deep-equal';
4
+ import { memo } from 'react';
5
+
6
+ import AgentSetting from '@/features/AgentSetting';
7
+ import { settingsSelectors, useGlobalStore } from '@/store/global';
8
+ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
9
+ import { SettingsTabs } from '@/store/global/initialState';
10
+
11
+ const Agent = memo(() => {
12
+ useSwitchSideBarOnInit(SettingsTabs.Agent);
13
+
14
+ const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
15
+ const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
16
+ const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
17
+
18
+ return (
19
+ <AgentSetting
20
+ config={config}
21
+ meta={meta}
22
+ onConfigChange={(config) => {
23
+ updateAgent({ config });
24
+ }}
25
+ onMetaChange={(meta) => {
26
+ updateAgent({ meta });
27
+ }}
28
+ />
29
+ );
30
+ });
31
+
32
+ export default Agent;
@@ -1,3 +1,15 @@
1
- import Index from './index';
1
+ 'use client';
2
2
 
3
- export default () => <Index />;
3
+ import { memo } from 'react';
4
+
5
+ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
+ import { SettingsTabs } from '@/store/global/initialState';
7
+
8
+ import Common from './Common';
9
+
10
+ const CommonSetting = memo(() => {
11
+ useSwitchSideBarOnInit(SettingsTabs.Common);
12
+ return <Common />;
13
+ });
14
+
15
+ export default CommonSetting;
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import { useGlobalStore } from '@/store/global';
6
6
 
7
- const Header = memo(() => {
7
+ const Index = memo(() => {
8
8
  const { t } = useTranslation('setting');
9
9
  const tab = useGlobalStore((s) => s.settingsTab);
10
10
 
@@ -19,4 +19,4 @@ const Header = memo(() => {
19
19
  );
20
20
  });
21
21
 
22
- export default Header;
22
+ export default Index;
@@ -8,7 +8,6 @@ import { useGlobalStore } from '@/store/global';
8
8
  const Header = memo(() => {
9
9
  const { t } = useTranslation('setting');
10
10
  const tab = useGlobalStore((s) => s.settingsTab);
11
-
12
11
  const router = useRouter();
13
12
 
14
13
  return (
@@ -0,0 +1,14 @@
1
+ import { useResponsive } from 'antd-style';
2
+ import { memo } from 'react';
3
+
4
+ import Desktop from './Desktop';
5
+ import Mobile from './Mobile';
6
+
7
+ const Header = memo(() => {
8
+ const { mobile } = useResponsive();
9
+ const Render = mobile ? Mobile : Desktop;
10
+
11
+ return <Render />;
12
+ });
13
+
14
+ export default Header;
@@ -1,18 +1,15 @@
1
- import { PropsWithChildren, memo } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  import { Center, Flexbox } from 'react-layout-kit';
3
3
 
4
4
  import SafeSpacing from '@/components/SafeSpacing';
5
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
6
- import { useSwitchSideBarOnInit } from '@/store/global';
7
- import { SidebarTabKey } from '@/store/global/initialState';
5
+ import AppLayout from '@/layout/AppLayout';
8
6
 
7
+ import Header from '../features/Header';
9
8
  import SideBar from '../features/SideBar';
10
- import Header from './features/Header';
11
9
 
12
- export default memo(({ children }: PropsWithChildren) => {
13
- useSwitchSideBarOnInit(SidebarTabKey.Setting);
10
+ const SettingLayout = ({ children }: PropsWithChildren) => {
14
11
  return (
15
- <AppLayoutDesktop>
12
+ <AppLayout>
16
13
  <SideBar />
17
14
  <Flexbox flex={1} height={'100vh'} style={{ position: 'relative' }}>
18
15
  <Header />
@@ -23,6 +20,8 @@ export default memo(({ children }: PropsWithChildren) => {
23
20
  </Center>
24
21
  </Flexbox>
25
22
  </Flexbox>
26
- </AppLayoutDesktop>
23
+ </AppLayout>
27
24
  );
28
- });
25
+ };
26
+
27
+ export default SettingLayout;
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+
3
+ import { PropsWithChildren } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import PageTitle from '@/components/PageTitle';
7
+ import ResponsiveLayout from '@/components/ResponsiveLayout';
8
+ import { useIsMobile } from '@/hooks/useIsMobile';
9
+ import { useSwitchSideBarOnInit } from '@/store/global';
10
+ import { SidebarTabKey } from '@/store/global/initialState';
11
+ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
12
+
13
+ import MobileLayout from '../layout.mobile';
14
+ import DesktopLayout from './Desktop';
15
+
16
+ const Setting = ({ children }: PropsWithChildren) => {
17
+ const { t } = useTranslation('setting');
18
+ const pageTitle = genSiteHeadTitle(t('header.global'));
19
+
20
+ useSwitchSideBarOnInit(SidebarTabKey.Setting);
21
+
22
+ return (
23
+ <>
24
+ <PageTitle title={pageTitle} />
25
+ <ResponsiveLayout Desktop={DesktopLayout} Mobile={MobileLayout} isMobile={useIsMobile}>
26
+ {children}
27
+ </ResponsiveLayout>
28
+ </>
29
+ );
30
+ };
31
+
32
+ export default Setting;
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+
3
+ import { PropsWithChildren } from 'react';
4
+ import { Flexbox } from 'react-layout-kit';
5
+
6
+ import AppMobileLayout from '@/layout/AppMobileLayout';
7
+
8
+ import Header from './features/Header';
9
+
10
+ const SettingLayout = ({ children }: PropsWithChildren) => (
11
+ <AppMobileLayout navBar={<Header />}>
12
+ <Flexbox style={{ overflow: 'auto' }}>{children}</Flexbox>
13
+ </AppMobileLayout>
14
+ );
15
+
16
+ export default SettingLayout;
@@ -0,0 +1,15 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import ResponsiveLayout from '@/components/ResponsiveLayout';
4
+ import { isMobileDevice } from '@/utils/responsive';
5
+
6
+ import Desktop from './layout.desktop';
7
+ import Mobile from './layout.mobile';
8
+
9
+ const Layout = ({ children }: PropsWithChildren) => (
10
+ <ResponsiveLayout Desktop={Desktop} Mobile={Mobile} isMobile={isMobileDevice}>
11
+ {children}
12
+ </ResponsiveLayout>
13
+ );
14
+
15
+ export default Layout;
@@ -1,3 +1,15 @@
1
- import Index from './index';
1
+ 'use client';
2
2
 
3
- export default () => <Index />;
3
+ import { memo } from 'react';
4
+
5
+ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
+ import { SettingsTabs } from '@/store/global/initialState';
7
+
8
+ import LLM from './LLM';
9
+
10
+ const LLMSetting = memo(() => {
11
+ useSwitchSideBarOnInit(SettingsTabs.LLM);
12
+ return <LLM />;
13
+ });
14
+
15
+ export default LLMSetting;
@@ -9,7 +9,7 @@ import { useExportConfig } from '@/hooks/useExportConfig';
9
9
  import { useImportConfig } from '@/hooks/useImportConfig';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
 
12
- import Item from '../../features/SideBar/Item';
12
+ import Item from '../features/SideBar/Item';
13
13
 
14
14
  const ExtraList = memo(() => {
15
15
  const { t } = useTranslation('common');
@@ -6,15 +6,16 @@ import { memo } from 'react';
6
6
  import { Center } from 'react-layout-kit';
7
7
 
8
8
  import pkg from '@/../package.json';
9
+ import Header from '@/app/market/(mobile)/Header';
9
10
  import AgentCardBanner from '@/app/market/features/AgentCard/AgentCardBanner';
10
11
  import AvatarWithUpload from '@/features/AvatarWithUpload';
12
+ import AppMobileLayout from '@/layout/AppMobileLayout';
11
13
  import { useGlobalStore, useSwitchSideBarOnInit } from '@/store/global';
12
14
  import { SidebarTabKey } from '@/store/global/initialState';
13
15
  import { AVATAR } from '@/store/session/slices/chat/actions/share';
14
16
 
15
- import List from '../../features/SideBar/List';
16
- import ExtraList from '../features/ExtraList';
17
- import Layout from './layout.mobile';
17
+ import List from '../features/SideBar/List';
18
+ import ExtraList from './ExtraList';
18
19
 
19
20
  const useStyles = createStyles(({ css, token }) => ({
20
21
  divider: css`
@@ -28,12 +29,11 @@ const useStyles = createStyles(({ css, token }) => ({
28
29
  }));
29
30
 
30
31
  const Setting = memo(() => {
31
- useSwitchSideBarOnInit(SidebarTabKey.Setting);
32
32
  const avatar = useGlobalStore((s) => s.settings.avatar);
33
33
  const { styles } = useStyles();
34
-
34
+ useSwitchSideBarOnInit(SidebarTabKey.Setting);
35
35
  return (
36
- <Layout>
36
+ <AppMobileLayout navBar={<Header />} showTabBar>
37
37
  <AgentCardBanner
38
38
  mask
39
39
  meta={{ avatar: avatar || AVATAR }}
@@ -54,7 +54,7 @@ const Setting = memo(() => {
54
54
  </Divider>
55
55
  </Center>
56
56
  </div>
57
- </Layout>
57
+ </AppMobileLayout>
58
58
  );
59
59
  });
60
60
 
@@ -0,0 +1,7 @@
1
+ import Page from './index';
2
+
3
+ const Index = () => {
4
+ return <Page />;
5
+ };
6
+
7
+ export default Index;
@@ -1,14 +1 @@
1
- import { isMobileDevice } from '@/utils/responsive';
2
-
3
- import DesktopPage from './(desktop)';
4
- import MobilePage from './(mobile)';
5
-
6
- const Page = () => {
7
- const mobile = isMobileDevice();
8
-
9
- const Page = mobile ? MobilePage : DesktopPage;
10
-
11
- return <Page />;
12
- };
13
-
14
- export default Page;
1
+ export { default } from './common/page';
@@ -3,14 +3,14 @@ import Link from 'next/link';
3
3
  import { PropsWithChildren, memo } from 'react';
4
4
  import { Center, Flexbox } from 'react-layout-kit';
5
5
 
6
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
6
+ import AppLayout from '@/layout/AppLayout';
7
7
 
8
8
  import { useStyles } from '../features/Banner/style';
9
9
 
10
10
  const Desktop = memo<PropsWithChildren>(({ children }) => {
11
11
  const { styles } = useStyles();
12
12
  return (
13
- <AppLayoutDesktop>
13
+ <AppLayout>
14
14
  <Center
15
15
  className={styles.layout}
16
16
  flex={1}
@@ -21,11 +21,11 @@ const Desktop = memo<PropsWithChildren>(({ children }) => {
21
21
  <Link href={'/'}>
22
22
  <Logo className={styles.logo} size={36} type={'text'} />
23
23
  </Link>
24
- <Flexbox className={styles.view} flex={1}>
24
+ <Flexbox className={styles.view} flex={1} style={{ maxWidth: 1024 }}>
25
25
  {children}
26
26
  </Flexbox>
27
27
  </Center>
28
- </AppLayoutDesktop>
28
+ </AppLayout>
29
29
  );
30
30
  });
31
31
 
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+
3
+ import { useResponsive } from 'antd-style';
4
+ import { PropsWithChildren, memo } from 'react';
5
+
6
+ import Mobile from '../MobileLayout';
7
+ import Desktop from './Desktop';
8
+
9
+ const ResponsiveLayout = memo<PropsWithChildren>(({ children }) => {
10
+ const { mobile } = useResponsive();
11
+
12
+ return mobile ? <Mobile>{children}</Mobile> : <Desktop>{children}</Desktop>;
13
+ });
14
+
15
+ export default ResponsiveLayout;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+
3
+ import { Logo, MobileNavBar } from '@lobehub/ui';
4
+ import { useTheme } from 'antd-style';
5
+ import { PropsWithChildren, memo } from 'react';
6
+
7
+ import AppMobileLayout from '@/layout/AppMobileLayout';
8
+
9
+ const MobileLayout = memo<PropsWithChildren>(({ children }) => {
10
+ const theme = useTheme();
11
+
12
+ return (
13
+ <AppMobileLayout
14
+ navBar={<MobileNavBar center={<Logo type={'text'} />} />}
15
+ showTabBar
16
+ style={{ background: theme.colorBgLayout }}
17
+ >
18
+ {children}
19
+ </AppMobileLayout>
20
+ );
21
+ });
22
+
23
+ export default MobileLayout;
@@ -1,10 +1,11 @@
1
1
  import { LogoThree } from '@lobehub/ui';
2
+ import { useResponsive } from 'antd-style';
2
3
  import { memo, useMemo } from 'react';
3
4
  import { useTranslation } from 'react-i18next';
4
5
 
5
6
  import { genSize, useStyles } from './style';
6
7
 
7
- const Hero = memo<{ mobile?: boolean; width: number }>(({ width, mobile }) => {
8
+ const Hero = memo<{ width: number }>(({ width }) => {
8
9
  const size = useMemo(
9
10
  () => ({
10
11
  base: genSize(width / 3.5, 240),
@@ -15,7 +16,7 @@ const Hero = memo<{ mobile?: boolean; width: number }>(({ width, mobile }) => {
15
16
  [width],
16
17
  );
17
18
  const { styles } = useStyles(size.base);
18
-
19
+ const { mobile } = useResponsive();
19
20
  const { t } = useTranslation('welcome');
20
21
 
21
22
  return (
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Icon } from '@lobehub/ui';
3
+ import { GridShowcase, Icon } from '@lobehub/ui';
4
4
  import { useSize } from 'ahooks';
5
5
  import { Button, Upload } from 'antd';
6
6
  import { SendHorizonal } from 'lucide-react';
@@ -16,12 +16,13 @@ import { useSessionStore } from '@/store/session';
16
16
  import Hero from './Hero';
17
17
  import { useStyles } from './style';
18
18
 
19
- const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
19
+ const Banner = memo<{ mobile?: boolean }>(() => {
20
20
  const { importConfig } = useImportConfig();
21
21
  const ref = useRef(null);
22
22
  const domSize = useSize(ref);
23
23
  const width = domSize?.width || 1024;
24
24
  const { t } = useTranslation('welcome');
25
+
25
26
  const { styles } = useStyles();
26
27
 
27
28
  const switchSession = useSessionStore((s) => s.switchSession);
@@ -31,38 +32,34 @@ const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
31
32
  }, []);
32
33
 
33
34
  return (
34
- <>
35
- <div className={styles.container} ref={ref}>
36
- <Hero mobile={mobile} width={width} />
37
- </div>
38
- <Flexbox
39
- className={styles.buttonGroup}
40
- gap={16}
41
- horizontal={!mobile}
42
- justify={'center'}
43
- width={'100%'}
44
- >
45
- <Upload maxCount={1} onChange={handleImport} showUploadList={false}>
46
- <Button block={mobile} size={'large'}>
47
- {t('button.import')}
48
- </Button>
49
- </Upload>
50
- <Link
51
- href={SESSION_CHAT_URL()}
52
- onClick={(e) => {
53
- e.preventDefault();
54
- switchSession();
55
- }}
56
- >
57
- <Button block={mobile} size={'large'} type={'primary'}>
58
- <Flexbox align={'center'} gap={4} horizontal justify={'center'}>
59
- {t('button.start')}
60
- <Icon icon={SendHorizonal} />
61
- </Flexbox>
62
- </Button>
63
- </Link>
64
- </Flexbox>
65
- </>
35
+ <Flexbox height={'80vh'} style={{ paddingTop: '10vh' }}>
36
+ <GridShowcase>
37
+ <div className={styles.container} ref={ref}>
38
+ <Hero width={width} />
39
+ </div>
40
+ <Flexbox gap={16} horizontal style={{ marginTop: 16 }}>
41
+ <Upload maxCount={1} onChange={handleImport} showUploadList={false}>
42
+ <Button size={'large'}>{t('button.import')}</Button>
43
+ </Upload>
44
+ <Link
45
+ href={SESSION_CHAT_URL()}
46
+ onClick={(e) => {
47
+ e.preventDefault();
48
+ switchSession();
49
+ }}
50
+ >
51
+ <Button size={'large'} type={'primary'}>
52
+ <Flexbox align={'center'} gap={4} horizontal>
53
+ {t('button.start')}
54
+ <Icon icon={SendHorizonal} />
55
+ </Flexbox>
56
+ </Button>
57
+ </Link>
58
+ </Flexbox>
59
+ </GridShowcase>
60
+ {/*TODO:暂时隐藏,待模板完成后再补回*/}
61
+ {/*<AgentTemplate width={width} />*/}
62
+ </Flexbox>
66
63
  );
67
64
  });
68
65