@lobehub/chat 1.0.1 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.0.2](https://github.com/lobehub/lobe-chat/compare/v1.0.1...v1.0.2)
6
+
7
+ <sup>Released on **2024-06-17**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Openai key and openai proxy are invalid in feature flags.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Openai key and openai proxy are invalid in feature flags, closes [#2886](https://github.com/lobehub/lobe-chat/issues/2886) ([ec4f481](https://github.com/lobehub/lobe-chat/commit/ec4f481))
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 1.0.1](https://github.com/lobehub/lobe-chat/compare/v1.0.0...v1.0.1)
6
31
 
7
32
  <sup>Released on **2024-06-17**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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",
@@ -5,6 +5,7 @@ import { ReactNode, memo, useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useProviderName } from '@/hooks/useProviderName';
8
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
8
9
  import { useUserStore } from '@/store/user';
9
10
  import { keyVaultsConfigSelectors } from '@/store/user/selectors';
10
11
  import { GlobalLLMProviderKey } from '@/types/user/settings';
@@ -29,7 +30,7 @@ const ProviderApiKeyForm = memo<ProviderApiKeyFormProps>(
29
30
  keyVaultsConfigSelectors.getVaultByProvider(provider)(s)?.baseURL,
30
31
  s.updateKeyVaultConfig,
31
32
  ]);
32
-
33
+ const { showOpenAIProxyUrl } = useServerConfigStore(featureFlagsSelectors);
33
34
  const providerName = useProviderName(provider);
34
35
 
35
36
  return (
@@ -47,7 +48,9 @@ const ProviderApiKeyForm = memo<ProviderApiKeyFormProps>(
47
48
  type={'block'}
48
49
  value={apiKey}
49
50
  />
51
+
50
52
  {showEndpoint &&
53
+ showOpenAIProxyUrl &&
51
54
  (showProxy ? (
52
55
  <Input
53
56
  onChange={(e) => {
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Flexbox } from 'react-layout-kit';
8
8
 
9
9
  import { useServerConfigStore } from '@/store/serverConfig';
10
- import { serverConfigSelectors } from '@/store/serverConfig/selectors';
10
+ import { featureFlagsSelectors, serverConfigSelectors } from '@/store/serverConfig/selectors';
11
11
 
12
12
  import APIKeyForm from './APIKeyForm';
13
13
  import AccessCodeForm from './AccessCodeForm';
@@ -30,35 +30,46 @@ const InvalidAccessCode = memo<InvalidAccessCodeProps>(({ id, provider }) => {
30
30
  const isEnabledOAuth = useServerConfigStore(serverConfigSelectors.enabledOAuthSSO);
31
31
  const defaultTab = isEnabledOAuth ? Tab.Oauth : Tab.Password;
32
32
  const [mode, setMode] = useState<Tab>(defaultTab);
33
+ const { showOpenAIApiKey } = useServerConfigStore(featureFlagsSelectors);
34
+ const isEnabledTab = showOpenAIApiKey || isEnabledOAuth;
33
35
 
34
36
  return (
35
37
  <ErrorActionContainer>
36
- <Segmented
37
- block
38
- onChange={(value) => setMode(value as Tab)}
39
- options={
40
- [
41
- isEnabledOAuth
42
- ? {
43
- icon: <Icon icon={ScanFace} />,
44
- label: t('oauth', { ns: 'common' }),
45
- value: Tab.Oauth,
46
- }
47
- : undefined,
48
- {
49
- icon: <Icon icon={AsteriskSquare} />,
50
- label: t('unlock.tabs.password'),
51
- value: Tab.Password,
52
- },
53
- { icon: <Icon icon={KeySquare} />, label: t('unlock.tabs.apiKey'), value: Tab.Api },
54
- ].filter(Boolean) as SegmentedLabeledOption[]
55
- }
56
- style={{ width: '100%' }}
57
- value={mode}
58
- />
38
+ {isEnabledTab && (
39
+ <Segmented
40
+ block
41
+ onChange={(value) => setMode(value as Tab)}
42
+ options={
43
+ [
44
+ isEnabledOAuth
45
+ ? {
46
+ icon: <Icon icon={ScanFace} />,
47
+ label: t('oauth', { ns: 'common' }),
48
+ value: Tab.Oauth,
49
+ }
50
+ : undefined,
51
+ {
52
+ icon: <Icon icon={AsteriskSquare} />,
53
+ label: t('unlock.tabs.password'),
54
+ value: Tab.Password,
55
+ },
56
+ showOpenAIApiKey
57
+ ? {
58
+ icon: <Icon icon={KeySquare} />,
59
+ label: t('unlock.tabs.apiKey'),
60
+ value: Tab.Api,
61
+ }
62
+ : undefined,
63
+ ].filter(Boolean) as SegmentedLabeledOption[]
64
+ }
65
+ style={{ width: '100%' }}
66
+ value={mode}
67
+ />
68
+ )}
69
+
59
70
  <Flexbox gap={24}>
60
71
  {mode === Tab.Password && <AccessCodeForm id={id} />}
61
- {mode === Tab.Api && <APIKeyForm id={id} provider={provider} />}
72
+ {showOpenAIApiKey && mode === Tab.Api && <APIKeyForm id={id} provider={provider} />}
62
73
  {isEnabledOAuth && mode === Tab.Oauth && <OAuthForm id={id} />}
63
74
  </Flexbox>
64
75
  </ErrorActionContainer>