File tree 4 files changed +8
-6
lines changed
4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export function LobeNextAuthDbAdapter(serverDB: NeonDatabase<typeof schema>): Ad
81
81
) ;
82
82
83
83
// 3. Create an inbox session for the user
84
- const agentService = new AgentService ( id ) ;
84
+ const agentService = new AgentService ( serverDB , id ) ;
85
85
await agentService . createInbox ( ) ;
86
86
87
87
return { ...user , id : providerAccountId ?? id } ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const agentProcedure = authedProcedure.use(async (opts) => {
19
19
return opts . next ( {
20
20
ctx : {
21
21
agentModel : new AgentModel ( serverDB , ctx . userId ) ,
22
- agentService : new AgentService ( ctx . userId ) ,
22
+ agentService : new AgentService ( serverDB , ctx . userId ) ,
23
23
fileModel : new FileModel ( serverDB , ctx . userId ) ,
24
24
knowledgeBaseModel : new KnowledgeBaseModel ( serverDB , ctx . userId ) ,
25
25
sessionModel : new SessionModel ( serverDB , ctx . userId ) ,
Original file line number Diff line number Diff line change 1
1
import { appEnv } from '@/config/app' ;
2
- import { serverDB } from '@/database/server' ;
3
2
import { SessionModel } from '@/database/server/models/session' ;
3
+ import { LobeChatDatabase } from '@/database/type' ;
4
4
import { parseAgentConfig } from '@/server/globalConfig/parseDefaultAgent' ;
5
5
6
6
export class AgentService {
7
7
private readonly userId : string ;
8
+ private readonly db : LobeChatDatabase ;
8
9
9
- constructor ( userId : string ) {
10
+ constructor ( db : LobeChatDatabase , userId : string ) {
10
11
this . userId = userId ;
12
+ this . db = db ;
11
13
}
12
14
13
15
async createInbox ( ) {
14
- const sessionModel = new SessionModel ( serverDB , this . userId ) ;
16
+ const sessionModel = new SessionModel ( this . db , this . userId ) ;
15
17
16
18
const defaultAgentConfig = parseAgentConfig ( appEnv . DEFAULT_AGENT_CONFIG ) || { } ;
17
19
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class UserService {
43
43
} ) ;
44
44
45
45
// 3. Create an inbox session for the user
46
- const agentService = new AgentService ( id ) ;
46
+ const agentService = new AgentService ( serverDB , id ) ;
47
47
await agentService . createInbox ( ) ;
48
48
49
49
/* ↓ cloud slot ↓ */
You can’t perform that action at this time.
0 commit comments