@lobehub/chat 1.36.3 → 1.36.5

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,48 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.36.5](https://github.com/lobehub/lobe-chat/compare/v1.36.4...v1.36.5)
6
+
7
+ <sup>Released on **2024-12-09**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix wrong email linking in next-auth db adapter.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix wrong email linking in next-auth db adapter, closes [#4919](https://github.com/lobehub/lobe-chat/issues/4919) ([af45a28](https://github.com/lobehub/lobe-chat/commit/af45a28))
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
+
30
+ ### [Version 1.36.4](https://github.com/lobehub/lobe-chat/compare/v1.36.3...v1.36.4)
31
+
32
+ <sup>Released on **2024-12-09**</sup>
33
+
34
+ <br/>
35
+
36
+ <details>
37
+ <summary><kbd>Improvements and Fixes</kbd></summary>
38
+
39
+ </details>
40
+
41
+ <div align="right">
42
+
43
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
44
+
45
+ </div>
46
+
5
47
  ### [Version 1.36.3](https://github.com/lobehub/lobe-chat/compare/v1.36.2...v1.36.3)
6
48
 
7
49
  <sup>Released on **2024-12-08**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix wrong email linking in next-auth db adapter."
6
+ ]
7
+ },
8
+ "date": "2024-12-09",
9
+ "version": "1.36.5"
10
+ },
11
+ {
12
+ "children": {},
13
+ "date": "2024-12-09",
14
+ "version": "1.36.4"
15
+ },
2
16
  {
3
17
  "children": {
4
18
  "fixes": [
@@ -17,8 +17,6 @@ We are excited to announce the official release of the long-awaited database Doc
17
17
  - **Cloud Synchronization**: Enjoy a seamless cloud data synchronization experience right after deployment.
18
18
  - **Flexible Authentication**: Supports integration with third-party SSO service providers like Auth0.
19
19
 
20
- ![LobeChat Database Docker Deployment Diagram](https://github.com/user-attachments/assets/database-docker-deploy)
21
-
22
20
  ## 📘 Upgraded Deployment Documentation
23
21
 
24
22
  To ensure users can complete the deployment smoothly, we have optimized the structure of our deployment documentation:
@@ -14,8 +14,6 @@ description: LobeChat v1.8.0 推出官方数据库 Docker 镜像,支持云端
14
14
  - **云端同步**:部署后即可享受流畅的云端数据同步体验
15
15
  - **灵活认证**:支持与 Auth0 等第三方 SSO 服务提供商集成
16
16
 
17
- ![LobeChat Database Docker 部署示意图](https://github.com/user-attachments/assets/database-docker-deploy)
18
-
19
17
  ## 📘 部署文档全新升级
20
18
 
21
19
  为确保用户能够顺利完成部署,我们优化了部署文档的结构:
@@ -17,7 +17,7 @@ In this version, we have nearly fully replicated the core features of Claude Art
17
17
 
18
18
  It is worth mentioning that the Python code execution feature has also been developed and will be available in future versions. At that time, users will be able to utilize both Claude Artifacts and OpenAI Code Interpreter, significantly enhancing the practicality of the AI assistant.
19
19
 
20
- ![Artifacts Feature Showcase](https://github.com/user-attachments/artifacts-demo.png)
20
+ ![Artifacts Feature Showcase](https://github.com/user-attachments/assets/639ed70b-abc5-476f-9eb0-10c739e5a115)
21
21
 
22
22
  ## 🔍 New Discovery Page: Explore More Possibilities
23
23
 
@@ -19,7 +19,7 @@ description: >-
19
19
 
20
20
  值得一提的是,Python 代码执行功能也已完成开发,将在后续版本中与大家见面。届时,用户将能够同时运用 Claude Artifacts 和 OpenAI Code Interpreter 这两大强大工具,极大提升 AI 助手的实用性。
21
21
 
22
- ![Artifacts 功能展示](https://github.com/user-attachments/artifacts-demo.png)
22
+ ![Artifacts 功能展示](https://github.com/user-attachments/assets/2787824c-a13c-466c-ba6f-820bddfe099f)
23
23
 
24
24
  ## 🔍 全新发现页面:探索更多可能
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.36.3",
3
+ "version": "1.36.5",
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",
@@ -151,7 +151,7 @@
151
151
  "debug": "^4.3.7",
152
152
  "dexie": "^3.2.7",
153
153
  "diff": "^5.2.0",
154
- "drizzle-orm": "^0.36.0",
154
+ "drizzle-orm": "^0.37.0",
155
155
  "drizzle-zod": "^0.5.1",
156
156
  "fast-deep-equal": "^3.1.3",
157
157
  "file-type": "^19.6.0",
@@ -194,6 +194,7 @@
194
194
  "pwa-install-handler": "^2.6.1",
195
195
  "query-string": "^9.1.1",
196
196
  "random-words": "^2.0.1",
197
+ "re-resizable": "6.10.1",
197
198
  "react": "^18.3.1",
198
199
  "react-confetti": "^6.1.0",
199
200
  "react-dom": "^18.3.1",
@@ -275,7 +276,7 @@
275
276
  "consola": "^3.2.3",
276
277
  "dotenv": "^16.4.5",
277
278
  "dpdm-fast": "^1.0.4",
278
- "drizzle-kit": "^0.28.0",
279
+ "drizzle-kit": "^0.29.0",
279
280
  "eslint": "^8.57.1",
280
281
  "eslint-plugin-mdx": "^2.3.4",
281
282
  "eslint-plugin-unused-imports": "4.0.1",
@@ -115,6 +115,37 @@ describe('LobeNextAuthDbAdapter', () => {
115
115
  await serverDB.query.users.findMany({ where: eq(users.email, user.email) }),
116
116
  ).toHaveLength(1);
117
117
  });
118
+
119
+ it('should create a user if id not exist and email is null', async () => {
120
+ // In previous version, it will link the account to the existing user if the email is null
121
+ // issue: https://github.com/lobehub/lobe-chat/issues/4918
122
+ expect(nextAuthAdapter).toBeDefined();
123
+ expect(nextAuthAdapter.createUser).toBeDefined();
124
+
125
+ const existUserId = 'user-db-1';
126
+ const existUserName = 'John Doe 1';
127
+ // @ts-expect-error: createUser is defined
128
+ await nextAuthAdapter.createUser({
129
+ ...user,
130
+ id: existUserId,
131
+ name: existUserName,
132
+ email: '',
133
+ });
134
+
135
+ const anotherUserId = 'user-db-2';
136
+ const anotherUserName = 'John Doe 2';
137
+ // @ts-expect-error: createUser is defined
138
+ await nextAuthAdapter.createUser({
139
+ ...user,
140
+ id: anotherUserId,
141
+ name: anotherUserName,
142
+ email: '',
143
+ });
144
+ // Should create a new user if id not exists and email is null
145
+ expect(
146
+ await serverDB.query.users.findMany({ where: eq(users.id, anotherUserId) }),
147
+ ).toHaveLength(1);
148
+ });
118
149
  });
119
150
 
120
151
  describe('deleteUser', () => {
@@ -8,8 +8,8 @@ import { and, eq } from 'drizzle-orm';
8
8
  import type { NeonDatabase } from 'drizzle-orm/neon-serverless';
9
9
  import { Adapter, AdapterAccount } from 'next-auth/adapters';
10
10
 
11
- import { UserModel } from '@/database/server/models/user';
12
11
  import * as schema from '@/database/schemas';
12
+ import { UserModel } from '@/database/server/models/user';
13
13
  import { merge } from '@/utils/merge';
14
14
 
15
15
  import {
@@ -53,7 +53,7 @@ export function LobeNextAuthDbAdapter(serverDB: NeonDatabase<typeof schema>): Ad
53
53
  async createUser(user): Promise<AdapterUser> {
54
54
  const { id, name, email, emailVerified, image, providerAccountId } = user;
55
55
  // return the user if it already exists
56
- let existingUser = await UserModel.findByEmail(serverDB, email);
56
+ let existingUser = email.trim() ? await UserModel.findByEmail(serverDB, email) : undefined;
57
57
  // If the user is not found by email, try to find by providerAccountId
58
58
  if (!existingUser && providerAccountId) {
59
59
  existingUser = await UserModel.findById(serverDB, providerAccountId);
@@ -169,7 +169,7 @@ export function LobeNextAuthDbAdapter(serverDB: NeonDatabase<typeof schema>): Ad
169
169
  },
170
170
 
171
171
  async getUserByEmail(email): Promise<AdapterUser | null> {
172
- const lobeUser = await UserModel.findByEmail(serverDB, email);
172
+ const lobeUser = email.trim() ? await UserModel.findByEmail(serverDB, email) : undefined;
173
173
  return lobeUser ? mapLobeUserToAdapterUser(lobeUser) : null;
174
174
  },
175
175