@lobehub/chat 0.83.2 → 0.83.3

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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.83.3](https://github.com/lobehub/lobe-chat/compare/v0.83.2...v0.83.3)
6
+
7
+ <sup>Released on **2023-10-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor the settings layout to rsc.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor the settings layout to rsc ([b840f44](https://github.com/lobehub/lobe-chat/commit/b840f44))
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
+
5
30
  ### [Version 0.83.2](https://github.com/lobehub/lobe-chat/compare/v0.83.1...v0.83.2)
6
31
 
7
32
  <sup>Released on **2023-10-06**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.83.2",
3
+ "version": "0.83.3",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -1,21 +1,32 @@
1
1
  'use client';
2
2
 
3
+ import isEqual from 'fast-deep-equal';
3
4
  import { memo } from 'react';
4
5
 
6
+ import AgentSetting from '@/features/AgentSetting';
7
+ import { settingsSelectors, useGlobalStore } from '@/store/global';
5
8
  import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
9
  import { SettingsTabs } from '@/store/global/initialState';
7
10
 
8
- import Layout from '../index';
9
- import Agent from './Agent';
10
-
11
- const AgentSetting = memo(() => {
11
+ const Agent = memo(() => {
12
12
  useSwitchSideBarOnInit(SettingsTabs.Agent);
13
13
 
14
+ const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
15
+ const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
16
+ const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
17
+
14
18
  return (
15
- <Layout>
16
- <Agent />
17
- </Layout>
19
+ <AgentSetting
20
+ config={config}
21
+ meta={meta}
22
+ onConfigChange={(config) => {
23
+ updateAgent({ config });
24
+ }}
25
+ onMetaChange={(meta) => {
26
+ updateAgent({ meta });
27
+ }}
28
+ />
18
29
  );
19
30
  });
20
31
 
21
- export default AgentSetting;
32
+ export default Agent;
@@ -5,16 +5,11 @@ import { memo } from 'react';
5
5
  import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
6
  import { SettingsTabs } from '@/store/global/initialState';
7
7
 
8
- import Layout from '../index';
9
8
  import Common from './Common';
10
9
 
11
10
  const CommonSetting = memo(() => {
12
11
  useSwitchSideBarOnInit(SettingsTabs.Common);
13
- return (
14
- <Layout>
15
- <Common />
16
- </Layout>
17
- );
12
+ return <Common />;
18
13
  });
19
14
 
20
15
  export default CommonSetting;
@@ -4,8 +4,8 @@ import { Center, Flexbox } from 'react-layout-kit';
4
4
  import SafeSpacing from '@/components/SafeSpacing';
5
5
  import AppLayout from '@/layout/AppLayout';
6
6
 
7
- import Header from './features/Header';
8
- import SideBar from './features/SideBar';
7
+ import Header from '../features/Header';
8
+ import SideBar from '../features/SideBar';
9
9
 
10
10
  const SettingLayout = memo<{ children: ReactNode }>(({ children }) => {
11
11
  return (
@@ -1,16 +1,16 @@
1
1
  'use client';
2
2
 
3
3
  import { useResponsive } from 'antd-style';
4
- import Head from 'next/head';
5
4
  import { ReactNode, memo } from 'react';
6
5
  import { useTranslation } from 'react-i18next';
7
6
 
7
+ import PageTitle from '@/components/PageTitle';
8
8
  import { useSwitchSideBarOnInit } from '@/store/global';
9
9
  import { SidebarTabKey } from '@/store/global/initialState';
10
10
  import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
11
11
 
12
- import DesktopLayout from './layout.desktop';
13
- import MobileLayout from './layout.mobile';
12
+ import MobileLayout from '../layout.mobile';
13
+ import DesktopLayout from './Desktop';
14
14
 
15
15
  const Setting = memo<{ children: ReactNode }>(({ children }) => {
16
16
  const { mobile } = useResponsive();
@@ -23,9 +23,7 @@ const Setting = memo<{ children: ReactNode }>(({ children }) => {
23
23
 
24
24
  return (
25
25
  <>
26
- <Head>
27
- <title>{pageTitle}</title>
28
- </Head>
26
+ <PageTitle title={pageTitle} />
29
27
  <RenderLayout>{children}</RenderLayout>
30
28
  </>
31
29
  );
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { ReactNode, memo } from 'react';
2
4
  import { Flexbox } from 'react-layout-kit';
3
5
 
@@ -0,0 +1,14 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import { isMobileDevice } from '@/utils/responsive';
4
+
5
+ import Desktop from './layout.desktop';
6
+ import Mobile from './layout.mobile';
7
+
8
+ const Layout = ({ children }: PropsWithChildren) => {
9
+ const mobile = isMobileDevice();
10
+
11
+ return mobile ? <Mobile>{children}</Mobile> : <Desktop>{children}</Desktop>;
12
+ };
13
+
14
+ export default Layout;
@@ -5,16 +5,11 @@ import { memo } from 'react';
5
5
  import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
6
  import { SettingsTabs } from '@/store/global/initialState';
7
7
 
8
- import Layout from '../index';
9
8
  import LLM from './LLM';
10
9
 
11
10
  const LLMSetting = memo(() => {
12
11
  useSwitchSideBarOnInit(SettingsTabs.LLM);
13
- return (
14
- <Layout>
15
- <LLM />
16
- </Layout>
17
- );
12
+ return <LLM />;
18
13
  });
19
14
 
20
15
  export default LLMSetting;
@@ -1,26 +0,0 @@
1
- import isEqual from 'fast-deep-equal';
2
- import { memo } from 'react';
3
-
4
- import AgentSetting from '@/features/AgentSetting';
5
- import { settingsSelectors, useGlobalStore } from '@/store/global';
6
-
7
- const Agent = memo(() => {
8
- const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
9
- const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
10
- const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
11
-
12
- return (
13
- <AgentSetting
14
- config={config}
15
- meta={meta}
16
- onConfigChange={(config) => {
17
- updateAgent({ config });
18
- }}
19
- onMetaChange={(meta) => {
20
- updateAgent({ meta });
21
- }}
22
- />
23
- );
24
- });
25
-
26
- export default Agent;