@lobehub/chat 0.36.1 → 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 CHANGED
@@ -2,6 +2,31 @@
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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 0.36.1](https://github.com/lobehub/lobe-chat/compare/v0.36.0...v0.36.1)
6
31
 
7
32
  <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.36.1",
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",
@@ -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,
@@ -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
- // TODO: 等 settings 里的 defaultAgent 都改好以后,做个合并即可
81
- const newSession: LobeAgentSession = merge({}, initLobeSession, {
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,
@@ -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>;