@lobehub/chat 1.22.23 → 1.22.24

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.22.24](https://github.com/lobehub/lobe-chat/compare/v1.22.23...v1.22.24)
6
+
7
+ <sup>Released on **2024-10-23**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Support `plugin` flag.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Support `plugin` flag, closes [#4463](https://github.com/lobehub/lobe-chat/issues/4463) ([9b4be23](https://github.com/lobehub/lobe-chat/commit/9b4be23))
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.22.23](https://github.com/lobehub/lobe-chat/compare/v1.22.22...v1.22.23)
6
31
 
7
32
  <sup>Released on **2024-10-23**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.22.23",
3
+ "version": "1.22.24",
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",
@@ -17,6 +17,7 @@ export const FeatureFlagsSchema = z.object({
17
17
  create_session: z.boolean().optional(),
18
18
  edit_agent: z.boolean().optional(),
19
19
 
20
+ plugins: z.boolean().optional(),
20
21
  dalle: z.boolean().optional(),
21
22
  speech_to_text: z.boolean().optional(),
22
23
  token_counter: z.boolean().optional(),
@@ -53,10 +54,12 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
53
54
  create_session: true,
54
55
  edit_agent: true,
55
56
 
57
+ plugins: true,
56
58
  dalle: true,
57
59
 
58
60
  check_updates: true,
59
61
  welcome_suggest: true,
62
+ token_counter: true,
60
63
 
61
64
  knowledge_base: true,
62
65
  rag_eval: false,
@@ -86,6 +89,7 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
86
89
  showOpenAIApiKey: config.openai_api_key,
87
90
  showOpenAIProxyUrl: config.openai_proxy_url,
88
91
 
92
+ enablePlugins: config.plugins,
89
93
  showDalle: config.dalle,
90
94
 
91
95
  enableCheckUpdates: config.check_updates,
@@ -1,3 +1,5 @@
1
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
2
+
1
3
  import AgentChat from './AgentChat';
2
4
  import AgentMeta from './AgentMeta';
3
5
  import AgentModal from './AgentModal';
@@ -10,6 +12,7 @@ import { Provider, createStore } from './store';
10
12
  type AgentSettingsProps = StoreUpdaterProps;
11
13
 
12
14
  export const AgentSettings = (props: AgentSettingsProps) => {
15
+ const { enablePlugins } = useServerConfigStore(featureFlagsSelectors);
13
16
  return (
14
17
  <Provider createStore={createStore}>
15
18
  <StoreUpdater {...props} />
@@ -18,7 +21,7 @@ export const AgentSettings = (props: AgentSettingsProps) => {
18
21
  <AgentChat />
19
22
  <AgentModal />
20
23
  <AgentTTS />
21
- <AgentPlugin />
24
+ {enablePlugins && <AgentPlugin />}
22
25
  </Provider>
23
26
  );
24
27
  };
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
5
5
 
6
6
  import { useAgentStore } from '@/store/agent';
7
7
  import { agentSelectors } from '@/store/agent/selectors';
8
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
8
9
  import { useUserStore } from '@/store/user';
9
10
  import { modelProviderSelectors } from '@/store/user/selectors';
10
11
 
@@ -12,21 +13,24 @@ import DropdownMenu from './Dropdown';
12
13
 
13
14
  const Tools = memo(() => {
14
15
  const { t } = useTranslation('setting');
16
+ const { enablePlugins } = useServerConfigStore(featureFlagsSelectors);
15
17
 
16
18
  const model = useAgentStore(agentSelectors.currentAgentModel);
17
19
  const enableFC = useUserStore(modelProviderSelectors.isModelEnabledFunctionCall(model));
18
20
 
19
21
  return (
20
- <Suspense fallback={<ActionIcon icon={LucideLoader2} spin />}>
21
- <DropdownMenu>
22
- <ActionIcon
23
- disable={!enableFC}
24
- icon={Blocks}
25
- placement={'bottom'}
26
- title={t(enableFC ? 'tools.title' : 'tools.disabled')}
27
- />
28
- </DropdownMenu>
29
- </Suspense>
22
+ enablePlugins && (
23
+ <Suspense fallback={<ActionIcon icon={LucideLoader2} spin />}>
24
+ <DropdownMenu>
25
+ <ActionIcon
26
+ disable={!enableFC}
27
+ icon={Blocks}
28
+ placement={'bottom'}
29
+ title={t(enableFC ? 'tools.title' : 'tools.disabled')}
30
+ />
31
+ </DropdownMenu>
32
+ </Suspense>
33
+ )
30
34
  );
31
35
  });
32
36
 
@@ -19,6 +19,7 @@ describe('featureFlagsSelectors', () => {
19
19
  expect(result).toEqual({
20
20
  enableWebrtc: false,
21
21
  isAgentEditable: false,
22
+ enablePlugins: true,
22
23
  showCreateSession: true,
23
24
  enableRAGEval: false,
24
25
  showDalle: true,