@lobehub/chat 1.5.1 → 1.5.2
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 +25 -0
- package/package.json +1 -1
- package/src/services/session/client.test.ts +1 -0
- package/src/services/session/client.ts +4 -1
- package/src/services/session/server.ts +4 -7
- package/src/store/chat/slices/message/action.ts +3 -0
- package/src/store/session/slices/session/action.ts +7 -7
- package/src/types/session/index.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 1.5.2](https://github.com/lobehub/lobe-chat/compare/v1.5.1...v1.5.2)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-07-17**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix session not reorder after send message.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix session not reorder after send message, closes [#3239](https://github.com/lobehub/lobe-chat/issues/3239) ([7245a08](https://github.com/lobehub/lobe-chat/commit/7245a08))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 1.5.1](https://github.com/lobehub/lobe-chat/compare/v1.5.0...v1.5.1)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-07-17**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
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",
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SessionGroupItem,
|
|
16
16
|
SessionGroups,
|
|
17
17
|
} from '@/types/session';
|
|
18
|
+
import { merge } from '@/utils/merge';
|
|
18
19
|
|
|
19
20
|
import { ISessionService } from './type';
|
|
20
21
|
|
|
@@ -94,7 +95,9 @@ export class ClientService implements ISessionService {
|
|
|
94
95
|
data: Partial<Pick<LobeAgentSession, 'group' | 'meta' | 'pinned'>>,
|
|
95
96
|
) {
|
|
96
97
|
const pinned = typeof data.pinned === 'boolean' ? (data.pinned ? 1 : 0) : undefined;
|
|
97
|
-
|
|
98
|
+
const prev = await SessionModel.findById(id);
|
|
99
|
+
|
|
100
|
+
return SessionModel.update(id, merge(prev, { ...data, pinned }));
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
async updateSessionConfig(
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
LobeAgentSession,
|
|
14
14
|
LobeSessionType,
|
|
15
15
|
LobeSessions,
|
|
16
|
-
SessionGroupId,
|
|
17
16
|
SessionGroupItem,
|
|
18
17
|
SessionGroups,
|
|
18
|
+
UpdateSessionParams,
|
|
19
19
|
} from '@/types/session';
|
|
20
20
|
|
|
21
21
|
import { ISessionService } from './type';
|
|
@@ -54,14 +54,11 @@ export class ServerService implements ISessionService {
|
|
|
54
54
|
return lambdaClient.session.countSessions.query();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
updateSession(
|
|
58
|
-
|
|
59
|
-
data: Partial<{ group?: SessionGroupId; meta?: any; pinned?: boolean }>,
|
|
60
|
-
): Promise<any> {
|
|
61
|
-
const { group, pinned, meta } = data;
|
|
57
|
+
updateSession(id: string, data: Partial<UpdateSessionParams>): Promise<any> {
|
|
58
|
+
const { group, pinned, meta, updatedAt } = data;
|
|
62
59
|
return lambdaClient.session.updateSession.mutate({
|
|
63
60
|
id,
|
|
64
|
-
value: { groupId: group === 'default' ? null : group, pinned, ...meta },
|
|
61
|
+
value: { groupId: group === 'default' ? null : group, pinned, ...meta, updatedAt },
|
|
65
62
|
});
|
|
66
63
|
}
|
|
67
64
|
|
|
@@ -19,6 +19,7 @@ import { agentSelectors } from '@/store/agent/selectors';
|
|
|
19
19
|
import { chatHelpers } from '@/store/chat/helpers';
|
|
20
20
|
import { messageMapKey } from '@/store/chat/slices/message/utils';
|
|
21
21
|
import { ChatStore } from '@/store/chat/store';
|
|
22
|
+
import { useSessionStore } from '@/store/session';
|
|
22
23
|
import { ChatMessage, ChatMessageError, MessageToolCall } from '@/types/message';
|
|
23
24
|
import { TraceEventPayloads } from '@/types/trace';
|
|
24
25
|
import { setNamespace } from '@/utils/storeDebug';
|
|
@@ -319,6 +320,8 @@ export const chatMessage: StateCreator<
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
}
|
|
323
|
+
// update assistant update to make it rerank
|
|
324
|
+
useSessionStore.getState().triggerSessionUpdate(get().activeId);
|
|
322
325
|
|
|
323
326
|
const id = await get().internal_createMessage(newMessage, {
|
|
324
327
|
tempMessageId,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
LobeSessionGroups,
|
|
19
19
|
LobeSessionType,
|
|
20
20
|
LobeSessions,
|
|
21
|
-
|
|
21
|
+
UpdateSessionParams,
|
|
22
22
|
} from '@/types/session';
|
|
23
23
|
import { merge } from '@/utils/merge';
|
|
24
24
|
import { setNamespace } from '@/utils/storeDebug';
|
|
@@ -52,6 +52,7 @@ export interface SessionAction {
|
|
|
52
52
|
isSwitchSession?: boolean,
|
|
53
53
|
) => Promise<string>;
|
|
54
54
|
duplicateSession: (id: string) => Promise<void>;
|
|
55
|
+
triggerSessionUpdate: (id: string) => Promise<void>;
|
|
55
56
|
updateSessionGroupId: (sessionId: string, groupId: string) => Promise<void>;
|
|
56
57
|
updateSessionMeta: (meta: Partial<MetaData>) => void;
|
|
57
58
|
|
|
@@ -75,10 +76,7 @@ export interface SessionAction {
|
|
|
75
76
|
useSearchSessions: (keyword?: string) => SWRResponse<any>;
|
|
76
77
|
|
|
77
78
|
internal_dispatchSessions: (payload: SessionDispatch) => void;
|
|
78
|
-
internal_updateSession: (
|
|
79
|
-
id: string,
|
|
80
|
-
data: Partial<{ group?: SessionGroupId; meta?: any; pinned?: boolean }>,
|
|
81
|
-
) => Promise<void>;
|
|
79
|
+
internal_updateSession: (id: string, data: Partial<UpdateSessionParams>) => Promise<void>;
|
|
82
80
|
internal_processSessions: (
|
|
83
81
|
sessions: LobeSessions,
|
|
84
82
|
customGroups: LobeSessionGroups,
|
|
@@ -117,7 +115,6 @@ export const createSessionSlice: StateCreator<
|
|
|
117
115
|
|
|
118
116
|
return id;
|
|
119
117
|
},
|
|
120
|
-
|
|
121
118
|
duplicateSession: async (id) => {
|
|
122
119
|
const { switchSession, refreshSessions } = get();
|
|
123
120
|
const session = sessionSelectors.getSessionById(id)(get());
|
|
@@ -153,7 +150,6 @@ export const createSessionSlice: StateCreator<
|
|
|
153
150
|
pinSession: async (id, pinned) => {
|
|
154
151
|
await get().internal_updateSession(id, { pinned });
|
|
155
152
|
},
|
|
156
|
-
|
|
157
153
|
removeSession: async (sessionId) => {
|
|
158
154
|
await sessionService.removeSession(sessionId);
|
|
159
155
|
await get().refreshSessions();
|
|
@@ -170,6 +166,10 @@ export const createSessionSlice: StateCreator<
|
|
|
170
166
|
set({ activeId: sessionId }, false, n(`activeSession/${sessionId}`));
|
|
171
167
|
},
|
|
172
168
|
|
|
169
|
+
triggerSessionUpdate: async (id) => {
|
|
170
|
+
await get().internal_updateSession(id, { updatedAt: new Date() });
|
|
171
|
+
},
|
|
172
|
+
|
|
173
173
|
updateSearchKeywords: (keywords) => {
|
|
174
174
|
set(
|
|
175
175
|
{ isSearching: !!keywords, sessionSearchKeywords: keywords },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LobeSessions } from '@/types/session/agentSession';
|
|
2
|
-
import { LobeSessionGroups } from '@/types/session/sessionGroup';
|
|
2
|
+
import { LobeSessionGroups, SessionGroupId } from '@/types/session/sessionGroup';
|
|
3
3
|
|
|
4
4
|
export * from './agentSession';
|
|
5
5
|
export * from './sessionGroup';
|
|
@@ -8,3 +8,10 @@ export interface ChatSessionList {
|
|
|
8
8
|
sessionGroups: LobeSessionGroups;
|
|
9
9
|
sessions: LobeSessions;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateSessionParams {
|
|
13
|
+
group?: SessionGroupId;
|
|
14
|
+
meta?: any;
|
|
15
|
+
pinned?: boolean;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|