@lobehub/chat 0.152.2 → 0.152.4

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 (42) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/package.json +1 -1
  3. package/src/app/(main)/(mobile)/me/features/Cate.tsx +3 -2
  4. package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +1 -3
  5. package/src/app/(main)/chat/features/SettingButton.tsx +4 -8
  6. package/src/app/(main)/chat/settings/m/page.tsx +15 -0
  7. package/src/app/(main)/settings/@category/features/CategoryContent.tsx +6 -4
  8. package/src/app/(main)/settings/about/index.tsx +35 -0
  9. package/src/app/(main)/settings/about/page.tsx +6 -21
  10. package/src/app/(main)/settings/agent/{layout.tsx → index.tsx} +17 -4
  11. package/src/app/(main)/settings/agent/page.tsx +1 -22
  12. package/src/app/(main)/settings/common/index.tsx +19 -0
  13. package/src/app/(main)/settings/common/page.tsx +1 -17
  14. package/src/app/(main)/settings/llm/index.tsx +47 -0
  15. package/src/app/(main)/settings/llm/page.tsx +3 -42
  16. package/src/app/(main)/settings/m/page.tsx +19 -0
  17. package/src/app/(main)/settings/sync/index.tsx +17 -0
  18. package/src/app/(main)/settings/sync/page.tsx +3 -15
  19. package/src/app/(main)/settings/tts/index.tsx +15 -0
  20. package/src/app/(main)/settings/tts/page.tsx +1 -15
  21. package/src/app/@modal/(.)settings/m/index.tsx +34 -0
  22. package/src/app/@modal/(.)settings/{layout.tsx → m/layout.tsx} +1 -1
  23. package/src/app/@modal/(.)settings/m/page.tsx +10 -0
  24. package/src/app/@modal/_layout/Desktop.tsx +32 -0
  25. package/src/app/@modal/_layout/Mobile.tsx +1 -0
  26. package/src/app/@modal/chat/(.)settings/{features → m/features}/CategoryContent.tsx +1 -1
  27. package/src/app/@modal/chat/(.)settings/{layout.tsx → m/layout.tsx} +1 -1
  28. package/src/app/@modal/chat/(.)settings/{page.tsx → m/page.tsx} +3 -9
  29. package/src/app/(main)/settings/about/layout.tsx +0 -26
  30. package/src/app/(main)/settings/about/loading.tsx +0 -5
  31. package/src/app/(main)/settings/agent/loading.tsx +0 -5
  32. package/src/app/@modal/(.)settings/about/layout.tsx +0 -1
  33. package/src/app/@modal/(.)settings/about/page.tsx +0 -1
  34. package/src/app/@modal/(.)settings/agent/layout.tsx +0 -1
  35. package/src/app/@modal/(.)settings/agent/page.tsx +0 -1
  36. package/src/app/@modal/(.)settings/common/page.tsx +0 -1
  37. package/src/app/@modal/(.)settings/llm/page.tsx +0 -1
  38. package/src/app/@modal/(.)settings/sync/page.tsx +0 -1
  39. package/src/app/@modal/(.)settings/tts/page.tsx +0 -1
  40. /package/src/app/@modal/(.)settings/{loading.tsx → m/loading.tsx} +0 -0
  41. /package/src/app/@modal/chat/(.)settings/{features → m/features}/useCategory.tsx +0 -0
  42. /package/src/app/@modal/chat/(.)settings/{loading.tsx → m/loading.tsx} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.152.4](https://github.com/lobehub/lobe-chat/compare/v0.152.3...v0.152.4)
6
+
7
+ <sup>Released on **2024-05-01**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix router path in UserPanel.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix router path in UserPanel ([c779e02](https://github.com/lobehub/lobe-chat/commit/c779e02))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 0.152.3](https://github.com/lobehub/lobe-chat/compare/v0.152.2...v0.152.3)
31
+
32
+ <sup>Released on **2024-05-01**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix intercepting-routes on mobile.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix intercepting-routes on mobile ([abe228c](https://github.com/lobehub/lobe-chat/commit/abe228c))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 0.152.2](https://github.com/lobehub/lobe-chat/compare/v0.152.1...v0.152.2)
6
56
 
7
57
  <sup>Released on **2024-05-01**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.152.2",
3
+ "version": "0.152.4",
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",
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { useTheme } from 'antd-style';
4
+ import { useRouter } from 'next/navigation';
4
5
  import { memo } from 'react';
5
6
  import { Flexbox } from 'react-layout-kit';
6
7
  import urlJoin from 'url-join';
@@ -8,11 +9,11 @@ import urlJoin from 'url-join';
8
9
  import { useCategory } from '@/app/(main)/settings//hooks/useCategory';
9
10
  import Cell from '@/components/Cell';
10
11
  import Divider from '@/components/Cell/Divider';
11
- import redirectHard from '@/server/redirectHard';
12
12
 
13
13
  const SettingCate = memo(() => {
14
14
  const theme = useTheme();
15
15
  const settingItems = useCategory({ mobile: true });
16
+ const router = useRouter();
16
17
 
17
18
  return (
18
19
  <Flexbox style={{ background: theme.colorBgContainer }} width={'100%'}>
@@ -23,7 +24,7 @@ const SettingCate = memo(() => {
23
24
  icon={icon}
24
25
  key={key}
25
26
  label={label}
26
- onClick={() => redirectHard(urlJoin('/settings', key))}
27
+ onClick={() => router.replace(urlJoin('/settings', key))}
27
28
  />
28
29
  );
29
30
  })}
@@ -86,9 +86,7 @@ export const useMenu = () => {
86
86
  icon: <Icon icon={Settings2} />,
87
87
  key: 'setting',
88
88
  label: <NewVersionBadge showBadge={hasNewVersion}>{t('userPanel.setting')}</NewVersionBadge>,
89
- onClick: () => {
90
- router.push('/settings/common');
91
- },
89
+ onClick: () => router.push('/settings/m', { tab: 'common' }),
92
90
  },
93
91
  {
94
92
  type: 'divider',
@@ -1,23 +1,19 @@
1
1
  import { ActionIcon } from '@lobehub/ui';
2
2
  import { AlignJustify } from 'lucide-react';
3
- import { useRouter } from 'next/navigation';
4
3
  import { memo } from 'react';
5
4
  import { useTranslation } from 'react-i18next';
6
5
 
7
6
  import { DESKTOP_HEADER_ICON_SIZE, MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
8
- import redirectHard from '@/server/redirectHard';
7
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
9
8
  import { useGlobalStore } from '@/store/global';
10
9
  import { SidebarTabKey } from '@/store/global/initialState';
11
10
  import { useSessionStore } from '@/store/session';
12
11
  import { sessionSelectors } from '@/store/session/selectors';
13
- import { pathString } from '@/utils/url';
14
12
 
15
13
  const SettingButton = memo<{ mobile?: boolean }>(({ mobile }) => {
16
14
  const isInbox = useSessionStore(sessionSelectors.isInboxSession);
17
15
  const { t } = useTranslation('common');
18
- const router = useRouter();
19
-
20
- const push = mobile ? redirectHard : router.push;
16
+ const router = useQueryRoute();
21
17
 
22
18
  return (
23
19
  <ActionIcon
@@ -27,9 +23,9 @@ const SettingButton = memo<{ mobile?: boolean }>(({ mobile }) => {
27
23
  useGlobalStore.setState({
28
24
  sidebarKey: SidebarTabKey.Setting,
29
25
  });
30
- push('/settings/agent');
26
+ router.push(mobile ? '/settings/agent' : '/settings/m', mobile ? {} : { tab: 'agent' });
31
27
  } else {
32
- push(pathString('/chat/settings', { search: location.search }));
28
+ router.push(mobile ? '/chat/settings' : '/chat/settings/m');
33
29
  }
34
30
  }}
35
31
  size={mobile ? MOBILE_HEADER_ICON_SIZE : DESKTOP_HEADER_ICON_SIZE}
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+
3
+ import { useLayoutEffect } from 'react';
4
+
5
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
6
+
7
+ export default () => {
8
+ const router = useQueryRoute();
9
+
10
+ useLayoutEffect(() => {
11
+ router.replace('/chat/settings');
12
+ }, []);
13
+
14
+ return null;
15
+ };
@@ -5,12 +5,15 @@ import urlJoin from 'url-join';
5
5
 
6
6
  import Menu from '@/components/Menu';
7
7
  import { useActiveSettingsKey } from '@/hooks/useActiveSettingsKey';
8
+ import { useQuery } from '@/hooks/useQuery';
8
9
  import { useQueryRoute } from '@/hooks/useQueryRoute';
10
+ import { SettingsTabs } from '@/store/global/initialState';
9
11
 
10
12
  import { useCategory } from '../../hooks/useCategory';
11
13
 
12
14
  const CategoryContent = memo<{ modal?: boolean }>(({ modal }) => {
13
15
  const activeTab = useActiveSettingsKey();
16
+ const { tab = SettingsTabs.Common } = useQuery();
14
17
  const cateItems = useCategory();
15
18
  const router = useQueryRoute();
16
19
 
@@ -18,15 +21,14 @@ const CategoryContent = memo<{ modal?: boolean }>(({ modal }) => {
18
21
  <Menu
19
22
  items={cateItems}
20
23
  onClick={({ key }) => {
21
- const path = urlJoin('/settings', key);
22
24
  if (modal) {
23
- router.replace(path);
25
+ router.replace('/settings/m', { tab: key });
24
26
  } else {
25
- router.push(path);
27
+ router.push(urlJoin('/settings', key));
26
28
  }
27
29
  }}
28
30
  selectable
29
- selectedKeys={[activeTab as any]}
31
+ selectedKeys={[modal ? tab : (activeTab as any)]}
30
32
  variant={'compact'}
31
33
  />
32
34
  );
@@ -0,0 +1,35 @@
1
+ import { Logo, Tag } from '@lobehub/ui';
2
+ import { Flexbox } from 'react-layout-kit';
3
+
4
+ import Follow from '@//features/Follow';
5
+ import AboutList from '@/app/(main)/settings//about/features/AboutList';
6
+ import Analytics from '@/app/(main)/settings/about/features/Analytics';
7
+ import { getServerConfig } from '@/config/server';
8
+ import { CURRENT_VERSION } from '@/const/version';
9
+
10
+ const enabledTelemetryChat = getServerConfig().ENABLE_LANGFUSE;
11
+
12
+ const COPYRIGHT = `© 2023-${new Date().getFullYear()} LobeHub, LLC`;
13
+
14
+ const Page = ({ mobile }: { mobile?: boolean }) => {
15
+ return (
16
+ <Flexbox align={'center'} gap={12} paddingBlock={36} width={'100%'}>
17
+ <Logo size={mobile ? 100 : 120} />
18
+ <h1 style={{ fontSize: mobile ? 32 : 36, fontWeight: 900, lineHeight: 1, marginBottom: 0 }}>
19
+ LobeChat
20
+ </h1>
21
+ <Tag>v{CURRENT_VERSION}</Tag>
22
+ <Flexbox gap={24} style={{ marginBlock: 48 }} width={'100%'}>
23
+ <AboutList />
24
+ {enabledTelemetryChat && <Analytics />}
25
+ </Flexbox>
26
+ <Follow />
27
+ <div>Empowering your AI dreams by LobeHub</div>
28
+ <div style={{ fontWeight: 400, opacity: 0.33 }}>{COPYRIGHT}</div>
29
+ </Flexbox>
30
+ );
31
+ };
32
+
33
+ Page.displayName = 'AboutSetting';
34
+
35
+ export default Page;
@@ -1,12 +1,7 @@
1
- import { Flexbox } from 'react-layout-kit';
2
-
3
- import Follow from '@//features/Follow';
4
- import AboutList from '@/app/(main)/settings//about/features/AboutList';
5
- import Analytics from '@/app/(main)/settings/about/features/Analytics';
6
- import { getServerConfig } from '@/config/server';
7
1
  import { translation } from '@/server/translation';
2
+ import { isMobileDevice } from '@/utils/responsive';
8
3
 
9
- const enabledTelemetryChat = getServerConfig().ENABLE_LANGFUSE;
4
+ import Page from './index';
10
5
 
11
6
  export const generateMetadata = async () => {
12
7
  const { t } = await translation('setting');
@@ -15,18 +10,8 @@ export const generateMetadata = async () => {
15
10
  };
16
11
  };
17
12
 
18
- const Page = () => {
19
- return (
20
- <>
21
- <Flexbox gap={24} style={{ marginBlock: 48 }} width={'100%'}>
22
- <AboutList />
23
- {enabledTelemetryChat && <Analytics />}
24
- </Flexbox>
25
- <Follow />
26
- </>
27
- );
28
- };
29
-
30
- Page.displayName = 'AboutSetting';
13
+ export default () => {
14
+ const isMobile = isMobileDevice();
31
15
 
32
- export default Page;
16
+ return <Page mobile={isMobile} />;
17
+ };
@@ -1,15 +1,21 @@
1
1
  'use client';
2
2
 
3
3
  import isEqual from 'fast-deep-equal';
4
- import { PropsWithChildren, memo } from 'react';
4
+ import { memo } from 'react';
5
5
 
6
6
  import { INBOX_SESSION_ID } from '@/const/session';
7
+ import AgentChat from '@/features/AgentSetting/AgentChat';
8
+ import AgentMeta from '@/features/AgentSetting/AgentMeta';
9
+ import AgentModal from '@/features/AgentSetting/AgentModal';
10
+ import AgentPlugin from '@/features/AgentSetting/AgentPlugin';
11
+ import AgentPrompt from '@/features/AgentSetting/AgentPrompt';
12
+ import AgentTTS from '@/features/AgentSetting/AgentTTS';
7
13
  import StoreUpdater from '@/features/AgentSetting/StoreUpdater';
8
14
  import { Provider, createStore } from '@/features/AgentSetting/store';
9
15
  import { useUserStore } from '@/store/user';
10
16
  import { settingsSelectors } from '@/store/user/selectors';
11
17
 
12
- const Layout = memo(({ children }: PropsWithChildren) => {
18
+ const Page = memo(() => {
13
19
  const config = useUserStore(settingsSelectors.defaultAgentConfig, isEqual);
14
20
  const meta = useUserStore(settingsSelectors.defaultAgentMeta, isEqual);
15
21
  const [updateAgent] = useUserStore((s) => [s.updateDefaultAgent]);
@@ -27,9 +33,16 @@ const Layout = memo(({ children }: PropsWithChildren) => {
27
33
  updateAgent({ meta });
28
34
  }}
29
35
  />
30
- {children}
36
+ <AgentPrompt />
37
+ <AgentMeta />
38
+ <AgentChat />
39
+ <AgentModal />
40
+ <AgentTTS />
41
+ <AgentPlugin />
31
42
  </Provider>
32
43
  );
33
44
  });
34
45
 
35
- export default Layout;
46
+ Page.displayName = 'AgentSetting';
47
+
48
+ export default Page;
@@ -1,9 +1,3 @@
1
- import AgentChat from '@/features/AgentSetting/AgentChat';
2
- import AgentMeta from '@/features/AgentSetting/AgentMeta';
3
- import AgentModal from '@/features/AgentSetting/AgentModal';
4
- import AgentPlugin from '@/features/AgentSetting/AgentPlugin';
5
- import AgentPrompt from '@/features/AgentSetting/AgentPrompt';
6
- import AgentTTS from '@/features/AgentSetting/AgentTTS';
7
1
  import { translation } from '@/server/translation';
8
2
 
9
3
  export const generateMetadata = async () => {
@@ -13,19 +7,4 @@ export const generateMetadata = async () => {
13
7
  };
14
8
  };
15
9
 
16
- const Page = () => {
17
- return (
18
- <>
19
- <AgentPrompt />
20
- <AgentMeta />
21
- <AgentChat />
22
- <AgentModal />
23
- <AgentTTS />
24
- <AgentPlugin />
25
- </>
26
- );
27
- };
28
-
29
- Page.displayName = 'AgentSetting';
30
-
31
- export default Page;
10
+ export { default } from './index';
@@ -0,0 +1,19 @@
1
+ import { getServerConfig } from '@/config/server';
2
+
3
+ import Common from './features/Common';
4
+ import Theme from './features/Theme';
5
+
6
+ const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
7
+
8
+ const Page = () => {
9
+ return (
10
+ <>
11
+ <Theme />
12
+ <Common showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />
13
+ </>
14
+ );
15
+ };
16
+
17
+ Page.displayName = 'CommonSetting';
18
+
19
+ export default Page;
@@ -1,9 +1,5 @@
1
- import { getServerConfig } from '@/config/server';
2
1
  import { translation } from '@/server/translation';
3
2
 
4
- import Common from './features/Common';
5
- import Theme from './features/Theme';
6
-
7
3
  export const generateMetadata = async () => {
8
4
  const { t } = await translation('setting');
9
5
  return {
@@ -11,16 +7,4 @@ export const generateMetadata = async () => {
11
7
  };
12
8
  };
13
9
 
14
- const Page = () => {
15
- const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
16
- return (
17
- <>
18
- <Theme />
19
- <Common showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />
20
- </>
21
- );
22
- };
23
-
24
- Page.displayName = 'CommonSetting';
25
-
26
- export default Page;
10
+ export { default } from './index';
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+
3
+ import { Flexbox } from 'react-layout-kit';
4
+
5
+ import Anthropic from './Anthropic';
6
+ import Azure from './Azure';
7
+ import Bedrock from './Bedrock';
8
+ import Google from './Google';
9
+ import Groq from './Groq';
10
+ import Minimax from './Minimax';
11
+ import Mistral from './Mistral';
12
+ import Moonshot from './Moonshot';
13
+ import Ollama from './Ollama';
14
+ import OpenAI from './OpenAI';
15
+ import OpenRouter from './OpenRouter';
16
+ import Perplexity from './Perplexity';
17
+ import TogetherAI from './TogetherAI';
18
+ import ZeroOne from './ZeroOne';
19
+ import Zhipu from './Zhipu';
20
+ import Footer from './components/Footer';
21
+
22
+ const Page = () => {
23
+ return (
24
+ <Flexbox gap={24}>
25
+ <OpenAI />
26
+ <Azure />
27
+ <Ollama />
28
+ <Google />
29
+ <Anthropic />
30
+ <Bedrock />
31
+ <OpenRouter />
32
+ <TogetherAI />
33
+ <Groq />
34
+ <Perplexity />
35
+ <Minimax />
36
+ <Mistral />
37
+ <Moonshot />
38
+ <Zhipu />
39
+ <ZeroOne />
40
+ <Footer />
41
+ </Flexbox>
42
+ );
43
+ };
44
+
45
+ Page.displayName = 'LlmSetting';
46
+
47
+ export default Page;
@@ -1,25 +1,9 @@
1
1
  import { notFound } from 'next/navigation';
2
- import { Flexbox } from 'react-layout-kit';
3
2
 
4
3
  import { serverFeatureFlags } from '@/config/server/featureFlags';
5
4
  import { translation } from '@/server/translation';
6
5
 
7
- import Anthropic from './Anthropic';
8
- import Azure from './Azure';
9
- import Bedrock from './Bedrock';
10
- import Google from './Google';
11
- import Groq from './Groq';
12
- import Minimax from './Minimax';
13
- import Mistral from './Mistral';
14
- import Moonshot from './Moonshot';
15
- import Ollama from './Ollama';
16
- import OpenAI from './OpenAI';
17
- import OpenRouter from './OpenRouter';
18
- import Perplexity from './Perplexity';
19
- import TogetherAI from './TogetherAI';
20
- import ZeroOne from './ZeroOne';
21
- import Zhipu from './Zhipu';
22
- import Footer from './components/Footer';
6
+ import Page from './index';
23
7
 
24
8
  export const generateMetadata = async () => {
25
9
  const { t } = await translation('setting');
@@ -28,32 +12,9 @@ export const generateMetadata = async () => {
28
12
  };
29
13
  };
30
14
 
31
- const Page = () => {
15
+ export default () => {
32
16
  const showLLM = serverFeatureFlags().showLLM;
33
17
  if (!showLLM) return notFound();
34
18
 
35
- return (
36
- <Flexbox gap={24}>
37
- <OpenAI />
38
- <Azure />
39
- <Ollama />
40
- <Google />
41
- <Anthropic />
42
- <Bedrock />
43
- <OpenRouter />
44
- <TogetherAI />
45
- <Groq />
46
- <Perplexity />
47
- <Minimax />
48
- <Mistral />
49
- <Moonshot />
50
- <Zhipu />
51
- <ZeroOne />
52
- <Footer />
53
- </Flexbox>
54
- );
19
+ return <Page />;
55
20
  };
56
-
57
- Page.displayName = 'LlmSetting';
58
-
59
- export default Page;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import { useLayoutEffect } from 'react';
4
+ import urlJoin from 'url-join';
5
+
6
+ import { useQuery } from '@/hooks/useQuery';
7
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
8
+ import { SettingsTabs } from '@/store/global/initialState';
9
+
10
+ export default () => {
11
+ const { tab = SettingsTabs.Common } = useQuery();
12
+ const router = useQueryRoute();
13
+
14
+ useLayoutEffect(() => {
15
+ router.replace(urlJoin('/settings', tab as string), { tab: null });
16
+ }, []);
17
+
18
+ return null;
19
+ };
@@ -0,0 +1,17 @@
1
+ import Alert from './features/Alert';
2
+ import DeviceInfo from './features/DeviceInfo';
3
+ import WebRTC from './features/WebRTC';
4
+
5
+ const Page = ({ browser, os, mobile }: { browser?: string; mobile?: boolean; os?: string }) => {
6
+ return (
7
+ <>
8
+ <DeviceInfo browser={browser} os={os} />
9
+ <WebRTC />
10
+ <Alert mobile={mobile} />
11
+ </>
12
+ );
13
+ };
14
+
15
+ Page.displayName = 'SyncSetting';
16
+
17
+ export default Page;
@@ -4,9 +4,7 @@ import { serverFeatureFlags } from '@/config/server/featureFlags';
4
4
  import { translation } from '@/server/translation';
5
5
  import { gerServerDeviceInfo, isMobileDevice } from '@/utils/responsive';
6
6
 
7
- import Alert from './features/Alert';
8
- import DeviceInfo from './features/DeviceInfo';
9
- import WebRTC from './features/WebRTC';
7
+ import Page from './index';
10
8
 
11
9
  export const generateMetadata = async () => {
12
10
  const { t } = await translation('setting');
@@ -15,22 +13,12 @@ export const generateMetadata = async () => {
15
13
  };
16
14
  };
17
15
 
18
- const Page = () => {
16
+ export default () => {
19
17
  const enableWebrtc = serverFeatureFlags().enableWebrtc;
20
18
  if (!enableWebrtc) return notFound();
21
19
 
22
20
  const isMobile = isMobileDevice();
23
21
  const { os, browser } = gerServerDeviceInfo();
24
22
 
25
- return (
26
- <>
27
- <DeviceInfo browser={browser} os={os} />
28
- <WebRTC />
29
- <Alert mobile={isMobile} />
30
- </>
31
- );
23
+ return <Page browser={browser} mobile={isMobile} os={os} />;
32
24
  };
33
-
34
- Page.displayName = 'SyncSetting';
35
-
36
- export default Page;
@@ -0,0 +1,15 @@
1
+ import OpenAI from './features/OpenAI';
2
+ import STT from './features/STT';
3
+
4
+ const Page = () => {
5
+ return (
6
+ <>
7
+ <STT />
8
+ <OpenAI />
9
+ </>
10
+ );
11
+ };
12
+
13
+ Page.displayName = 'TtsSetting';
14
+
15
+ export default Page;
@@ -1,8 +1,5 @@
1
1
  import { translation } from '@/server/translation';
2
2
 
3
- import OpenAI from './features/OpenAI';
4
- import STT from './features/STT';
5
-
6
3
  export const generateMetadata = async () => {
7
4
  const { t } = await translation('setting');
8
5
  return {
@@ -10,15 +7,4 @@ export const generateMetadata = async () => {
10
7
  };
11
8
  };
12
9
 
13
- const Page = () => {
14
- return (
15
- <>
16
- <STT />
17
- <OpenAI />
18
- </>
19
- );
20
- };
21
-
22
- Page.displayName = 'TtsSetting';
23
-
24
- export default Page;
10
+ export { default } from './index';
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+
3
+ import dynamic from 'next/dynamic';
4
+
5
+ import Common from '@/app/(main)/settings/common';
6
+ import { useQuery } from '@/hooks/useQuery';
7
+ import { SettingsTabs } from '@/store/global/initialState';
8
+
9
+ import Skeleton from './loading';
10
+
11
+ const loading = () => <Skeleton />;
12
+ const About = dynamic(() => import('@/app/(main)/settings/about'), { loading });
13
+ const LLM = dynamic(() => import('@/app/(main)/settings/llm'), { loading });
14
+ const TTS = dynamic(() => import('@/app/(main)/settings/tts'), { loading });
15
+ const Agent = dynamic(() => import('@/app/(main)/settings/agent'), { loading });
16
+ const Sync = dynamic(() => import('@/app/(main)/settings/sync'), { loading });
17
+
18
+ const Page = ({ browser, os, mobile }: { browser?: string; mobile?: boolean; os?: string }) => {
19
+ const { tab = SettingsTabs.Common } = useQuery();
20
+ return (
21
+ <>
22
+ {tab === SettingsTabs.Common && <Common />}
23
+ {tab === SettingsTabs.Sync && <Sync browser={browser} mobile={mobile} os={os} />}
24
+ {tab === SettingsTabs.LLM && <LLM />}
25
+ {tab === SettingsTabs.TTS && <TTS />}
26
+ {tab === SettingsTabs.Agent && <Agent />}
27
+ {tab === SettingsTabs.About && <About mobile={mobile} />}
28
+ </>
29
+ );
30
+ };
31
+
32
+ Page.displayName = 'SettingModal';
33
+
34
+ export default Page;
@@ -2,7 +2,7 @@ import { Skeleton } from 'antd';
2
2
  import dynamic from 'next/dynamic';
3
3
  import { PropsWithChildren } from 'react';
4
4
 
5
- import SettingModalLayout from '../_layout/SettingModalLayout';
5
+ import SettingModalLayout from '../../_layout/SettingModalLayout';
6
6
 
7
7
  const CategoryContent = dynamic(
8
8
  () => import('@/app/(main)/settings/@category/features/CategoryContent'),
@@ -0,0 +1,10 @@
1
+ import { gerServerDeviceInfo, isMobileDevice } from '@/utils/responsive';
2
+
3
+ import Page from './index';
4
+
5
+ export default () => {
6
+ const isMobile = isMobileDevice();
7
+ const { os, browser } = gerServerDeviceInfo();
8
+
9
+ return <Page browser={browser} mobile={isMobile} os={os} />;
10
+ };
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+
3
+ import { Modal } from '@lobehub/ui';
4
+ import { useRouter } from 'next/navigation';
5
+ import { PropsWithChildren, useState } from 'react';
6
+
7
+ const Layout = ({ children }: PropsWithChildren) => {
8
+ const [open, setOpen] = useState(true);
9
+ const router = useRouter();
10
+
11
+ return (
12
+ <Modal
13
+ footer={null}
14
+ onCancel={() => {
15
+ setOpen(false);
16
+ setTimeout(() => router.back(), 250);
17
+ }}
18
+ open={open}
19
+ styles={{
20
+ body: { display: 'flex', minHeight: 'min(75vh, 750px)', overflow: 'hidden', padding: 0 },
21
+ }}
22
+ title={false}
23
+ width={1024}
24
+ >
25
+ {children}
26
+ </Modal>
27
+ );
28
+ };
29
+
30
+ Layout.displayName = 'ModalLayout';
31
+
32
+ export default Layout;
@@ -0,0 +1 @@
1
+ export default () => null;
@@ -20,7 +20,7 @@ const CategoryContent = memo(() => {
20
20
  <Menu
21
21
  items={cateItems}
22
22
  onClick={({ key }) => {
23
- router.replace('/chat/settings', { tab: key });
23
+ router.replace('/chat/settings/m', { tab: key });
24
24
  }}
25
25
  selectable
26
26
  selectedKeys={[tab as any]}
@@ -13,7 +13,7 @@ import { agentSelectors } from '@/store/agent/slices/chat';
13
13
  import { useSessionStore } from '@/store/session';
14
14
  import { sessionMetaSelectors } from '@/store/session/selectors';
15
15
 
16
- import SettingModalLayout from '../../_layout/SettingModalLayout';
16
+ import SettingModalLayout from '../../../_layout/SettingModalLayout';
17
17
 
18
18
  const CategoryContent = dynamic(() => import('./features/CategoryContent'), {
19
19
  loading: () => <Skeleton paragraph={{ rows: 6 }} title={false} />,
@@ -1,28 +1,22 @@
1
1
  'use client';
2
2
 
3
3
  import dynamic from 'next/dynamic';
4
- import { useSearchParams } from 'next/navigation';
5
- import qs from 'query-string';
6
4
 
7
5
  import AgentMeta from '@/features/AgentSetting/AgentMeta';
6
+ import { useQuery } from '@/hooks/useQuery';
8
7
 
9
8
  import { SettingsTabs } from './features/useCategory';
10
9
  import Skeleton from './loading';
11
10
 
12
11
  const loading = () => <Skeleton />;
13
-
14
12
  const AgentChat = dynamic(() => import('@/features/AgentSetting/AgentChat'), { loading });
15
-
16
13
  const AgentPrompt = dynamic(() => import('@/features/AgentSetting/AgentPrompt'), { loading });
17
-
18
14
  const AgentPlugin = dynamic(() => import('@/features/AgentSetting/AgentPlugin'), { loading });
19
-
20
15
  const AgentModal = dynamic(() => import('@/features/AgentSetting/AgentModal'), { loading });
21
-
22
16
  const AgentTTS = dynamic(() => import('@/features/AgentSetting/AgentTTS'), { loading });
17
+
23
18
  const Page = () => {
24
- const rawQuery = useSearchParams();
25
- const { tab = SettingsTabs.Meta } = qs.parse(rawQuery.toString());
19
+ const { tab = SettingsTabs.Meta } = useQuery();
26
20
  return (
27
21
  <>
28
22
  {tab === SettingsTabs.Meta && <AgentMeta />}
@@ -1,26 +0,0 @@
1
- import { Logo, Tag } from '@lobehub/ui';
2
- import { PropsWithChildren } from 'react';
3
- import { Flexbox } from 'react-layout-kit';
4
-
5
- import { CURRENT_VERSION } from '@/const/version';
6
- import { isMobileDevice } from '@/utils/responsive';
7
-
8
- const COPYRIGHT = `© 2023-${new Date().getFullYear()} LobeHub, LLC`;
9
-
10
- const Layout = ({ children }: PropsWithChildren) => {
11
- const isMobile = isMobileDevice();
12
- return (
13
- <Flexbox align={'center'} gap={12} paddingBlock={36} width={'100%'}>
14
- <Logo size={isMobile ? 100 : 120} />
15
- <h1 style={{ fontSize: isMobile ? 32 : 36, fontWeight: 900, lineHeight: 1, marginBottom: 0 }}>
16
- LobeChat
17
- </h1>
18
- <Tag>v{CURRENT_VERSION}</Tag>
19
- {children}
20
- <div>Empowering your AI dreams by LobeHub</div>
21
- <div style={{ fontWeight: 400, opacity: 0.33 }}>{COPYRIGHT}</div>
22
- </Flexbox>
23
- );
24
- };
25
-
26
- export default Layout;
@@ -1,5 +0,0 @@
1
- import SkeletonLoading from '@/components/SkeletonLoading';
2
-
3
- export default () => {
4
- return <SkeletonLoading paragraph={{ rows: 3 }} title={false} />;
5
- };
@@ -1,5 +0,0 @@
1
- import SkeletonLoading from '@/components/SkeletonLoading';
2
-
3
- export default () => {
4
- return <SkeletonLoading paragraph={{ rows: 8 }} />;
5
- };
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/about/layout';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/about/page';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/agent/layout';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/agent/page';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/common/page';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/llm/page';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/sync/page';
@@ -1 +0,0 @@
1
- export { default } from '@/app/(main)/settings/tts/page';