@lobehub/chat 0.107.16 → 0.108.0

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.108.0](https://github.com/lobehub/lobe-chat/compare/v0.107.16...v0.108.0)
6
+
7
+ <sup>Released on **2023-12-03**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Hide the password form item in the settings when there is no `ACCESS_CODE` env.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Hide the password form item in the settings when there is no `ACCESS_CODE` env, closes [#568](https://github.com/lobehub/lobe-chat/issues/568) ([3b5f8b2](https://github.com/lobehub/lobe-chat/commit/3b5f8b2))
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.107.16](https://github.com/lobehub/lobe-chat/compare/v0.107.15...v0.107.16)
6
31
 
7
32
  <sup>Released on **2023-12-03**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.107.16",
3
+ "version": "0.108.0",
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",
@@ -6,14 +6,15 @@ import { FC, memo } from 'react';
6
6
  import ResponsiveIndex from '@/components/ResponsiveIndex';
7
7
 
8
8
  import Common from '../common';
9
+ import { SettingsCommonProps } from '../common/Common';
9
10
  import Layout from './layout.desktop';
10
11
 
11
12
  const Mobile: FC = dynamic(() => import('../(mobile)'), { ssr: false }) as FC;
12
13
 
13
- export default memo(() => (
14
+ export default memo<SettingsCommonProps>((props) => (
14
15
  <ResponsiveIndex Mobile={Mobile}>
15
16
  <Layout>
16
- <Common />
17
+ <Common {...props} />
17
18
  </Layout>
18
19
  </ResponsiveIndex>
19
20
  ));
@@ -21,7 +21,11 @@ import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from '../features/ThemeSwa
21
21
 
22
22
  type SettingItemGroup = ItemGroup;
23
23
 
24
- const Common = memo(() => {
24
+ export interface SettingsCommonProps {
25
+ showAccessCodeConfig: boolean;
26
+ }
27
+
28
+ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig }) => {
25
29
  const { t } = useTranslation('setting');
26
30
  const [form] = AntForm.useForm();
27
31
 
@@ -154,6 +158,7 @@ const Common = memo(() => {
154
158
  {
155
159
  children: <Input.Password placeholder={t('settingSystem.accessCode.placeholder')} />,
156
160
  desc: t('settingSystem.accessCode.desc'),
161
+ hidden: !showAccessCodeConfig,
157
162
  label: t('settingSystem.accessCode.title'),
158
163
  name: 'password',
159
164
  },
@@ -9,16 +9,16 @@ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOn
9
9
  import { SettingsTabs } from '@/store/global/initialState';
10
10
 
11
11
  import Footer from '../features/Footer';
12
- import Common from './Common';
12
+ import Common, { SettingsCommonProps } from './Common';
13
13
 
14
- export default memo(() => {
14
+ export default memo<SettingsCommonProps>((props) => {
15
15
  useSwitchSideBarOnInit(SettingsTabs.Common);
16
16
  const { t } = useTranslation('setting');
17
17
 
18
18
  return (
19
19
  <>
20
20
  <PageTitle title={t('tab.common')} />
21
- <Common />
21
+ <Common {...props} />
22
22
  <Footer>LobeChat v{CURRENT_VERSION}</Footer>
23
23
  </>
24
24
  );
@@ -1,3 +1,9 @@
1
+ import { getServerConfig } from '@/config/server';
2
+
1
3
  import Index from './index';
2
4
 
3
- export default () => <Index />;
5
+ export default () => {
6
+ const { SHOW_ACCESS_CODE_CONFIG } = getServerConfig();
7
+
8
+ return <Index showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} />;
9
+ };
@@ -1,3 +1,4 @@
1
+ import { getServerConfig } from '@/config/server';
1
2
  import { isMobileDevice } from '@/utils/responsive';
2
3
 
3
4
  import DesktopPage from './(desktop)';
@@ -8,7 +9,9 @@ const Page = () => {
8
9
 
9
10
  const Page = mobile ? MobilePage : DesktopPage;
10
11
 
11
- return <Page />;
12
+ const { SHOW_ACCESS_CODE_CONFIG } = getServerConfig();
13
+
14
+ return <Page showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} />;
12
15
  };
13
16
 
14
17
  export default Page;
@@ -33,8 +33,12 @@ export const getServerConfig = () => {
33
33
  regions = process.env.OPENAI_FUNCTION_REGIONS.split(',');
34
34
  }
35
35
 
36
+ const ACCESS_CODE = process.env.ACCESS_CODE;
37
+
36
38
  return {
37
- ACCESS_CODE: process.env.ACCESS_CODE,
39
+ ACCESS_CODE,
40
+
41
+ SHOW_ACCESS_CODE_CONFIG: !!ACCESS_CODE,
38
42
 
39
43
  OPENAI_API_KEY: process.env.OPENAI_API_KEY,
40
44
  OPENAI_PROXY_URL: process.env.OPENAI_PROXY_URL,