File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,10 @@ export class AgentRuntime implements IAgentRuntime {
234
234
235
235
this . #conversationLength =
236
236
opts . conversationLength ?? this . #conversationLength;
237
+
238
+ if ( ! opts . databaseAdapter ) {
239
+ throw new Error ( "No database adapter provided" ) ;
240
+ }
237
241
this . databaseAdapter = opts . databaseAdapter ;
238
242
// use the character id if it exists, otherwise use the agentId if it is passed in, otherwise use the character name
239
243
this . agentId =
@@ -249,15 +253,14 @@ export class AgentRuntime implements IAgentRuntime {
249
253
this . agentId ,
250
254
this . character . name ,
251
255
this . character . name
252
- ) ;
253
- this . ensureParticipantExists ( this . agentId , this . agentId ) ;
256
+ ) . then ( ( ) => {
257
+ // postgres needs the user to exist before you can add a participant
258
+ this . ensureParticipantExists ( this . agentId , this . agentId ) ;
259
+ } ) ;
254
260
255
261
elizaLogger . success ( "Agent ID" , this . agentId ) ;
256
262
257
263
this . fetch = ( opts . fetch as typeof fetch ) ?? this . fetch ;
258
- if ( ! opts . databaseAdapter ) {
259
- throw new Error ( "No database adapter provided" ) ;
260
- }
261
264
262
265
this . cacheManager = opts . cacheManager ;
263
266
You can’t perform that action at this time.
0 commit comments