@lobehub/chat 0.36.0 → 0.37.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 +50 -0
- package/package.json +2 -2
- package/src/const/settings.ts +0 -6
- package/src/pages/chat/SessionList/List/SessionItem.tsx +1 -1
- package/src/store/session/index.ts +4 -2
- package/src/store/session/slices/session/action.ts +4 -2
- package/src/store/settings/index.ts +4 -2
- package/src/types/settings.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.37.0](https://github.com/lobehub/lobe-chat/compare/v0.36.1...v0.37.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-08-03**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: 支持使用全局助手的设置作为默认助手的创建角色.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: 支持使用全局助手的设置作为默认助手的创建角色, closes [#44](https://github.com/lobehub/lobe-chat/issues/44) ([f91857d](https://github.com/lobehub/lobe-chat/commit/f91857d))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.36.1](https://github.com/lobehub/lobe-chat/compare/v0.36.0...v0.36.1)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-08-03**</sup>
|
|
33
|
+
|
|
34
|
+
#### ♻ Code Refactoring
|
|
35
|
+
|
|
36
|
+
- **misc**: Refactor zustand usage with v4.4.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### Code refactoring
|
|
44
|
+
|
|
45
|
+
- **misc**: Refactor zustand usage with v4.4, closes [#52](https://github.com/lobehub/lobe-chat/issues/52) ([4c65aa7](https://github.com/lobehub/lobe-chat/commit/4c65aa7))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 0.36.0](https://github.com/lobehub/lobe-chat/compare/v0.35.1...v0.36.0)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-08-03**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatbot",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"swr": "^2",
|
|
94
94
|
"ts-md5": "^1",
|
|
95
95
|
"uuid": "^9",
|
|
96
|
-
"zustand": "^4",
|
|
96
|
+
"zustand": "^4.4",
|
|
97
97
|
"zustand-utils": "^1"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
package/src/const/settings.ts
CHANGED
|
@@ -12,18 +12,12 @@ export const DEFAULT_BASE_SETTINGS: GlobalBaseSettings = {
|
|
|
12
12
|
enableMaxTokens: true,
|
|
13
13
|
endpoint: '',
|
|
14
14
|
fontSize: 14,
|
|
15
|
-
frequencyPenalty: 0,
|
|
16
15
|
historyCount: 24,
|
|
17
16
|
language: 'zh-CN',
|
|
18
|
-
maxTokens: 2000,
|
|
19
|
-
model: LanguageModel.GPT3_5,
|
|
20
17
|
neutralColor: '',
|
|
21
18
|
password: '',
|
|
22
|
-
presencePenalty: 0,
|
|
23
19
|
primaryColor: '',
|
|
24
|
-
temperature: 0.5,
|
|
25
20
|
themeMode: 'auto',
|
|
26
|
-
topP: 1,
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
export const DEFAULT_AGENT_CONFIG: LobeAgentConfig = {
|
|
@@ -29,7 +29,7 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading })
|
|
|
29
29
|
const { t } = useTranslation('common');
|
|
30
30
|
|
|
31
31
|
const { styles, theme } = useStyles();
|
|
32
|
-
const [defaultModel] = useSettings((s) => [s.settings.model], shallow);
|
|
32
|
+
const [defaultModel] = useSettings((s) => [s.settings.defaultAgent.config?.model], shallow);
|
|
33
33
|
|
|
34
34
|
const [
|
|
35
35
|
pin,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import equal from 'fast-deep-equal';
|
|
2
2
|
import { PersistOptions, devtools, persist } from 'zustand/middleware';
|
|
3
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
3
4
|
|
|
4
5
|
import { isDev } from '@/utils/env';
|
|
5
6
|
|
|
@@ -22,13 +23,14 @@ const persistOptions: PersistOptions<SessionStore, SessionPersist> = {
|
|
|
22
23
|
// version: Migration.targetVersion,
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
export const useSessionStore =
|
|
26
|
+
export const useSessionStore = createWithEqualityFn<SessionStore>()(
|
|
26
27
|
persist(
|
|
27
28
|
devtools(createStore, {
|
|
28
29
|
name: LOBE_CHAT + (isDev ? '_DEV' : ''),
|
|
29
30
|
}),
|
|
30
31
|
persistOptions,
|
|
31
32
|
),
|
|
33
|
+
equal,
|
|
32
34
|
);
|
|
33
35
|
|
|
34
36
|
export * from './selectors';
|
|
@@ -4,6 +4,7 @@ import Router from 'next/router';
|
|
|
4
4
|
import { StateCreator } from 'zustand/vanilla';
|
|
5
5
|
|
|
6
6
|
import { SessionStore, initLobeSession } from '@/store/session';
|
|
7
|
+
import { useSettings } from '@/store/settings';
|
|
7
8
|
import { LobeAgentSession, LobeSessions } from '@/types/session';
|
|
8
9
|
import { setNamespace } from '@/utils/storeDebug';
|
|
9
10
|
import { uuid } from '@/utils/uuid';
|
|
@@ -77,8 +78,9 @@ export const createSessionSlice: StateCreator<
|
|
|
77
78
|
|
|
78
79
|
const timestamp = Date.now();
|
|
79
80
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
81
|
+
// 合并 settings 里的 defaultAgent
|
|
82
|
+
const globalDefaultAgent = useSettings.getState().settings.defaultAgent;
|
|
83
|
+
const newSession: LobeAgentSession = merge({}, initLobeSession, globalDefaultAgent, {
|
|
82
84
|
createAt: timestamp,
|
|
83
85
|
id: uuid(),
|
|
84
86
|
updateAt: timestamp,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import equal from 'fast-deep-equal';
|
|
2
2
|
import { type PersistOptions, devtools, persist } from 'zustand/middleware';
|
|
3
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
3
4
|
|
|
4
5
|
import { isDev } from '@/utils/env';
|
|
5
6
|
|
|
@@ -12,13 +13,14 @@ const persistOptions: PersistOptions<SettingsStore> = {
|
|
|
12
13
|
skipHydration: true,
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export const useSettings =
|
|
16
|
+
export const useSettings = createWithEqualityFn<SettingsStore>()(
|
|
16
17
|
persist(
|
|
17
18
|
devtools(createStore, {
|
|
18
19
|
name: LOBE_SETTINGS + (isDev ? '_DEV' : ''),
|
|
19
20
|
}),
|
|
20
21
|
persistOptions,
|
|
21
22
|
),
|
|
23
|
+
equal,
|
|
22
24
|
);
|
|
23
25
|
|
|
24
26
|
export * from './selectors';
|
package/src/types/settings.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { NeutralColors, PrimaryColors } from '@lobehub/ui';
|
|
|
2
2
|
import type { ThemeMode } from 'antd-style';
|
|
3
3
|
|
|
4
4
|
import type { Locales } from '@/locales/resources';
|
|
5
|
-
import type { LanguageModel } from '@/types/llm';
|
|
6
5
|
import type { LobeAgentSession } from '@/types/session';
|
|
7
6
|
|
|
8
7
|
export interface GlobalBaseSettings {
|
|
@@ -14,18 +13,12 @@ export interface GlobalBaseSettings {
|
|
|
14
13
|
enableMaxTokens: boolean;
|
|
15
14
|
endpoint: string;
|
|
16
15
|
fontSize: number;
|
|
17
|
-
frequencyPenalty: number;
|
|
18
16
|
historyCount: number;
|
|
19
17
|
language: Locales;
|
|
20
|
-
maxTokens: number;
|
|
21
|
-
model: LanguageModel;
|
|
22
18
|
neutralColor: NeutralColors | '';
|
|
23
19
|
password: string;
|
|
24
|
-
presencePenalty: number;
|
|
25
20
|
primaryColor: PrimaryColors | '';
|
|
26
|
-
temperature: number;
|
|
27
21
|
themeMode: ThemeMode;
|
|
28
|
-
topP: number;
|
|
29
22
|
}
|
|
30
23
|
|
|
31
24
|
export type GlobalDefaultAgent = Partial<LobeAgentSession>;
|