@lobehub/chat 1.19.8 → 1.19.9

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.

Potentially problematic release.


This version of @lobehub/chat might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.19.9](https://github.com/lobehub/lobe-chat/compare/v1.19.8...v1.19.9)
6
+
7
+ <sup>Released on **2024-09-20**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix a bug with server agent config when user not exist.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix a bug with server agent config when user not exist, closes [#4034](https://github.com/lobehub/lobe-chat/issues/4034) ([f6a232b](https://github.com/lobehub/lobe-chat/commit/f6a232b))
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 1.19.8](https://github.com/lobehub/lobe-chat/compare/v1.19.7...v1.19.8)
6
31
 
7
32
  <sup>Released on **2024-09-19**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.19.8",
3
+ "version": "1.19.9",
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",
@@ -28,6 +28,7 @@ export const POST = async (req: Request): Promise<NextResponse> => {
28
28
  const userService = new UserService();
29
29
  switch (type) {
30
30
  case 'user.created': {
31
+ pino.info('creating user due to clerk webhook');
31
32
  return userService.createUser(data.id, data);
32
33
  }
33
34
  case 'user.deleted': {
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  import { INBOX_SESSION_ID } from '@/const/session';
4
+ import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
4
5
  import { AgentModel } from '@/database/server/models/agent';
5
6
  import { FileModel } from '@/database/server/models/file';
6
7
  import { KnowledgeBaseModel } from '@/database/server/models/knowledgeBase';
7
8
  import { SessionModel } from '@/database/server/models/session';
9
+ import { UserModel } from '@/database/server/models/user';
8
10
  import { pino } from '@/libs/logger';
9
11
  import { authedProcedure, router } from '@/libs/trpc';
10
12
  import { KnowledgeItem, KnowledgeType } from '@/types/knowledgeBase';
@@ -84,6 +86,10 @@ export const agentRouter = router({
84
86
  const item = await ctx.sessionModel.findByIdOrSlug(INBOX_SESSION_ID);
85
87
  // if there is no session for user, create one
86
88
  if (!item) {
89
+ // if there is no user, return default config
90
+ const user = await UserModel.findById(ctx.userId);
91
+ if (!user) return DEFAULT_AGENT_CONFIG;
92
+
87
93
  const res = await ctx.sessionModel.createInbox();
88
94
  pino.info('create inbox session', res);
89
95
  }
@@ -6,8 +6,6 @@ import { pino } from '@/libs/logger';
6
6
 
7
7
  export class UserService {
8
8
  createUser = async (id: string, params: UserJSON) => {
9
- pino.info('creating user due to clerk webhook');
10
-
11
9
  // Check if user already exists
12
10
  const res = await UserModel.findById(id);
13
11