@lobehub/chat 0.18.0 → 0.18.1

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.18.1](https://github.com/lobehub/lobe-chat/compare/v0.18.0...v0.18.1)
6
+
7
+ <sup>Released on **2023-07-24**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: 优化新会话的创建逻辑 session.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: 优化新会话的创建逻辑 session ([d70f22d](https://github.com/lobehub/lobe-chat/commit/d70f22d))
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.18.0](https://github.com/lobehub/lobe-chat/compare/v0.17.0...v0.18.0)
6
31
 
7
32
  <sup>Released on **2023-07-24**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -33,4 +33,5 @@ export const useSessionStore = create<SessionStore>()(
33
33
 
34
34
  export * from './selectors';
35
35
  export { initialLobeAgentConfig } from './slices/agentConfig';
36
+ export { initLobeSession } from './slices/session';
36
37
  export type { SessionStore } from './store';
@@ -1,9 +1,9 @@
1
+ import { merge } from 'lodash-es';
1
2
  import Router from 'next/router';
2
3
  import { StateCreator } from 'zustand/vanilla';
3
4
 
4
- import { SessionStore } from '@/store/session';
5
- import { LanguageModel } from '@/types/llm';
6
- import { LobeAgentSession, LobeSessionType } from '@/types/session';
5
+ import { SessionStore, initLobeSession } from '@/store/session';
6
+ import { LobeAgentSession } from '@/types/session';
7
7
  import { uuid } from '@/utils/uuid';
8
8
 
9
9
  import { SessionDispatch, sessionsReducer } from './reducers/session';
@@ -58,21 +58,12 @@ export const createSessionSlice: StateCreator<
58
58
 
59
59
  const timestamp = Date.now();
60
60
 
61
- const newSession: LobeAgentSession = {
62
- chats: {},
63
- config: {
64
- model: LanguageModel.GPT3_5,
65
- params: {
66
- temperature: 0.6,
67
- },
68
- systemRole: '',
69
- },
61
+ // TODO: 等 settings 里的 defaultAgent 都改好以后,做个合并即可
62
+ const newSession: LobeAgentSession = merge({}, initLobeSession, {
70
63
  createAt: timestamp,
71
64
  id: uuid(),
72
- meta: {},
73
- type: LobeSessionType.Agent,
74
65
  updateAt: timestamp,
75
- };
66
+ });
76
67
 
77
68
  dispatchSession({ session: newSession, type: 'addSession' });
78
69