@lobehub/chat 0.160.2 → 0.160.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.160.4](https://github.com/lobehub/lobe-chat/compare/v0.160.3...v0.160.4)
6
+
7
+ <sup>Released on **2024-05-20**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Modify bedrock provided model.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Modify bedrock provided model, closes [#2473](https://github.com/lobehub/lobe-chat/issues/2473) ([a1fabf6](https://github.com/lobehub/lobe-chat/commit/a1fabf6))
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.160.3](https://github.com/lobehub/lobe-chat/compare/v0.160.2...v0.160.3)
31
+
32
+ <sup>Released on **2024-05-19**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Add two feature flags: check_updates 、welcome_suggest.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Add two feature flags: check_updates 、welcome_suggest, closes [#2555](https://github.com/lobehub/lobe-chat/issues/2555) ([84c69c9](https://github.com/lobehub/lobe-chat/commit/84c69c9))
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.160.2](https://github.com/lobehub/lobe-chat/compare/v0.160.1...v0.160.2)
6
56
 
7
57
  <sup>Released on **2024-05-19**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.160.2",
3
+ "version": "0.160.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",
@@ -36,6 +36,8 @@ describe('mapFeatureFlagsEnvToState', () => {
36
36
  create_session: true,
37
37
  edit_agent: false,
38
38
  dalle: true,
39
+ check_updates: true,
40
+ welcome_suggest: true,
39
41
  };
40
42
 
41
43
  const expectedState = {
@@ -46,6 +48,8 @@ describe('mapFeatureFlagsEnvToState', () => {
46
48
  showOpenAIApiKey: true,
47
49
  showOpenAIProxyUrl: false,
48
50
  showDalle: true,
51
+ enableCheckUpdates: true,
52
+ showWelcomeSuggest: true,
49
53
  };
50
54
 
51
55
  const mappedState = mapFeatureFlagsEnvToState(config);
@@ -13,6 +13,9 @@ export const FeatureFlagsSchema = z.object({
13
13
  edit_agent: z.boolean().optional(),
14
14
 
15
15
  dalle: z.boolean().optional(),
16
+
17
+ check_updates: z.boolean().optional(),
18
+ welcome_suggest: z.boolean().optional(),
16
19
  });
17
20
 
18
21
  // TypeScript 类型,从 Zod schema 生成
@@ -30,6 +33,9 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
30
33
  edit_agent: true,
31
34
 
32
35
  dalle: true,
36
+
37
+ check_updates: true,
38
+ welcome_suggest: true,
33
39
  };
34
40
 
35
41
  export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
@@ -44,5 +50,8 @@ export const mapFeatureFlagsEnvToState = (config: IFeatureFlags) => {
44
50
  showOpenAIProxyUrl: config.openai_proxy_url,
45
51
 
46
52
  showDalle: config.dalle,
53
+
54
+ enableCheckUpdates: config.check_updates,
55
+ showWelcomeSuggest: config.welcome_suggest,
47
56
  };
48
57
  };
@@ -3,6 +3,11 @@ import { ModelProviderCard } from '@/types/llm';
3
3
  // ref https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html
4
4
  const Bedrock: ModelProviderCard = {
5
5
  chatModels: [
6
+ {
7
+ displayName: 'Titan Text G1 - Lite',
8
+ id: 'amazon.titan-text-lite-v1:0:4k',
9
+ tokens: 4000,
10
+ },
6
11
  {
7
12
  description:
8
13
  'Amazon Titan Text G1 - Express v1,上下文长度可达 8000 个 token,适合广泛的用途。',
@@ -10,6 +15,23 @@ const Bedrock: ModelProviderCard = {
10
15
  id: 'amazon.titan-text-express-v1:0:8k',
11
16
  tokens: 8000,
12
17
  },
18
+ {
19
+ displayName: 'Titan Text Premier',
20
+ id: 'amazon.titan-text-premier-v1:0:32K',
21
+ tokens: 32_000,
22
+ },
23
+ {
24
+ displayName: 'Jurassic-2 Mid',
25
+ enabled: true,
26
+ id: 'ai21.j2-mid-v1',
27
+ tokens: 8192,
28
+ },
29
+ {
30
+ displayName: 'Jurassic-2 Ultra',
31
+ enabled: true,
32
+ id: 'ai21.j2-ultra-v1',
33
+ tokens: 8192,
34
+ },
13
35
  {
14
36
  description:
15
37
  'Claude 3 Opus 是 Anthropic 最强大的人工智能模型,在处理高度复杂的任务方面具备顶尖性能。该模型能够以非凡的流畅性和类似人类的理解能力引导开放式的提示和未可见的场景。Claude 3 Opus 向我们展示生成式人工智能的美好前景。 Claude 3 Opus 可以处理图像和返回文本输出,并且提供 200K 上下文窗口。',
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Center, Flexbox } from 'react-layout-kit';
8
8
 
9
9
  import { useGreeting } from '@/hooks/useGreeting';
10
- import { useServerConfigStore } from '@/store/serverConfig';
10
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
11
11
 
12
12
  import AgentsSuggest from './AgentsSuggest';
13
13
  import QuestionSuggest from './QuestionSuggest';
@@ -44,6 +44,7 @@ const InboxWelcome = memo(() => {
44
44
  const { styles } = useStyles();
45
45
  const mobile = useServerConfigStore((s) => s.isMobile);
46
46
  const greeting = useGreeting();
47
+ const { showWelcomeSuggest } = useServerConfigStore(featureFlagsSelectors);
47
48
 
48
49
  return (
49
50
  <Center padding={16} width={'100%'}>
@@ -55,8 +56,12 @@ const InboxWelcome = memo(() => {
55
56
  <Markdown className={styles.desc} variant={'chat'}>
56
57
  {t('guide.defaultMessage')}
57
58
  </Markdown>
58
- <AgentsSuggest mobile={mobile} />
59
- <QuestionSuggest mobile={mobile} />
59
+ {
60
+ showWelcomeSuggest && <>
61
+ <AgentsSuggest mobile={mobile} />
62
+ <QuestionSuggest mobile={mobile} />
63
+ </>
64
+ }
60
65
  </Flexbox>
61
66
  </Center>
62
67
  );
@@ -1,4 +1,5 @@
1
1
  import { useGlobalStore } from '@/store/global';
2
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
2
3
 
3
4
  export const useNewVersion = () => {
4
5
  const [hasNewVersion, useCheckLatestVersion] = useGlobalStore((s) => [
@@ -6,7 +7,8 @@ export const useNewVersion = () => {
6
7
  s.useCheckLatestVersion,
7
8
  ]);
8
9
 
9
- useCheckLatestVersion();
10
+ const { enableCheckUpdates } = useServerConfigStore(featureFlagsSelectors);
11
+ useCheckLatestVersion(enableCheckUpdates);
10
12
 
11
13
  return hasNewVersion;
12
14
  };
@@ -2,9 +2,13 @@ import { act, renderHook } from '@testing-library/react';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { useUserStore } from '@/store/user';
5
+ import { ServerConfigStoreProvider } from '@/store/serverConfig';
5
6
 
6
7
  import { useMenu } from '../UserPanel/useMenu';
7
8
 
9
+ const wrapper: React.JSXElementConstructor<{ children: React.ReactNode }> = ({ children }) =>
10
+ <ServerConfigStoreProvider>{children}</ServerConfigStoreProvider>
11
+
8
12
  // Mock dependencies
9
13
  vi.mock('next/link', () => ({
10
14
  default: vi.fn(({ children }) => <div>{children}</div>),
@@ -69,7 +73,7 @@ describe('useMenu', () => {
69
73
  enableAuth = true;
70
74
  enableClerk = false;
71
75
 
72
- const { result } = renderHook(() => useMenu());
76
+ const { result } = renderHook(() => useMenu(), { wrapper });
73
77
 
74
78
  act(() => {
75
79
  const { mainItems, logoutItems } = result.current;
@@ -89,7 +93,7 @@ describe('useMenu', () => {
89
93
  enableAuth = true;
90
94
  enableClerk = true;
91
95
 
92
- const { result } = renderHook(() => useMenu());
96
+ const { result } = renderHook(() => useMenu(), { wrapper });
93
97
 
94
98
  act(() => {
95
99
  const { mainItems, logoutItems } = result.current;
@@ -108,7 +112,7 @@ describe('useMenu', () => {
108
112
  });
109
113
  enableAuth = false;
110
114
 
111
- const { result } = renderHook(() => useMenu());
115
+ const { result } = renderHook(() => useMenu(), { wrapper });
112
116
 
113
117
  act(() => {
114
118
  const { mainItems, logoutItems } = result.current;
@@ -127,7 +131,7 @@ describe('useMenu', () => {
127
131
  });
128
132
  enableAuth = true;
129
133
 
130
- const { result } = renderHook(() => useMenu());
134
+ const { result } = renderHook(() => useMenu(), { wrapper });
131
135
 
132
136
  act(() => {
133
137
  const { mainItems, logoutItems } = result.current;
@@ -27,7 +27,7 @@ export interface GlobalStoreAction {
27
27
  toggleMobileTopic: (visible?: boolean) => void;
28
28
  toggleSystemRole: (visible?: boolean) => void;
29
29
  updatePreference: (preference: Partial<GlobalPreference>, action?: any) => void;
30
- useCheckLatestVersion: () => SWRResponse<string>;
30
+ useCheckLatestVersion: (enabledCheck?: boolean) => SWRResponse<string>;
31
31
  useInitGlobalPreference: () => SWRResponse;
32
32
  }
33
33
 
@@ -79,8 +79,8 @@ export const globalActionSlice: StateCreator<
79
79
  get().preferenceStorage.saveToLocalStorage(nextPreference);
80
80
  },
81
81
 
82
- useCheckLatestVersion: () =>
83
- useSWR('checkLatestVersion', globalService.getLatestVersion, {
82
+ useCheckLatestVersion: (enabledCheck = true) =>
83
+ useSWR(enabledCheck ? 'checkLatestVersion' : null, globalService.getLatestVersion, {
84
84
  // check latest version every 30 minutes
85
85
  focusThrottleInterval: 1000 * 60 * 30,
86
86
  onSuccess: (data: string) => {
@@ -24,6 +24,8 @@ describe('featureFlagsSelectors', () => {
24
24
  showLLM: false,
25
25
  showOpenAIApiKey: true,
26
26
  showOpenAIProxyUrl: true,
27
+ enableCheckUpdates: true,
28
+ showWelcomeSuggest: true,
27
29
  });
28
30
  });
29
31
  });