@lobehub/chat 1.36.35 → 1.36.36
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,23 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.36.36](https://github.com/lobehub/lobe-chat/compare/v1.36.35...v1.36.36)
|
6
|
+
|
7
|
+
<sup>Released on **2024-12-19**</sup>
|
8
|
+
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<details>
|
12
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
13
|
+
|
14
|
+
</details>
|
15
|
+
|
16
|
+
<div align="right">
|
17
|
+
|
18
|
+
[](#readme-top)
|
19
|
+
|
20
|
+
</div>
|
21
|
+
|
5
22
|
### [Version 1.36.35](https://github.com/lobehub/lobe-chat/compare/v1.36.34...v1.36.35)
|
6
23
|
|
7
24
|
<sup>Released on **2024-12-18**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.36.
|
3
|
+
"version": "1.36.36",
|
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",
|
@@ -294,6 +294,16 @@ export class MessageModel {
|
|
294
294
|
return result[0].count;
|
295
295
|
};
|
296
296
|
|
297
|
+
hasMoreThanN = async (n: number): Promise<boolean> => {
|
298
|
+
const result = await this.db
|
299
|
+
.select({ id: messages.id })
|
300
|
+
.from(messages)
|
301
|
+
.where(eq(messages.userId, this.userId))
|
302
|
+
.limit(n + 1);
|
303
|
+
|
304
|
+
return result.length > n;
|
305
|
+
};
|
306
|
+
|
297
307
|
// **************** Create *************** //
|
298
308
|
|
299
309
|
create = async (
|
@@ -95,6 +95,16 @@ export class SessionModel {
|
|
95
95
|
return result[0].count;
|
96
96
|
};
|
97
97
|
|
98
|
+
hasMoreThanN = async (n: number): Promise<boolean> => {
|
99
|
+
const result = await this.db
|
100
|
+
.select({ id: sessions.id })
|
101
|
+
.from(sessions)
|
102
|
+
.where(eq(sessions.userId, this.userId))
|
103
|
+
.limit(n + 1);
|
104
|
+
|
105
|
+
return result.length > n;
|
106
|
+
};
|
107
|
+
|
98
108
|
// **************** Create *************** //
|
99
109
|
|
100
110
|
create = async ({
|
@@ -58,16 +58,17 @@ export const userRouter = router({
|
|
58
58
|
}
|
59
59
|
|
60
60
|
const messageModel = new MessageModel(serverDB, ctx.userId);
|
61
|
-
const
|
61
|
+
const hasMoreThan4Messages = await messageModel.hasMoreThanN(4);
|
62
62
|
|
63
63
|
const sessionModel = new SessionModel(serverDB, ctx.userId);
|
64
|
-
const
|
64
|
+
const hasAnyMessages = await messageModel.hasMoreThanN(0);
|
65
|
+
const hasExtraSession = await sessionModel.hasMoreThanN(1);
|
65
66
|
|
66
67
|
return {
|
67
|
-
canEnablePWAGuide:
|
68
|
-
canEnableTrace:
|
68
|
+
canEnablePWAGuide: hasMoreThan4Messages,
|
69
|
+
canEnableTrace: hasMoreThan4Messages,
|
69
70
|
// 有消息,或者创建过助手,则认为有 conversation
|
70
|
-
hasConversation:
|
71
|
+
hasConversation: hasAnyMessages || hasExtraSession,
|
71
72
|
|
72
73
|
// always return true for community version
|
73
74
|
isOnboard: state.isOnboarded || true,
|