File tree 2 files changed +17
-6
lines changed
packages/adapter-postgres/src
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import readline from "readline";
32
32
import yargs from "yargs" ;
33
33
import path from "path" ;
34
34
import { fileURLToPath } from "url" ;
35
- import blobert from "./blobert .ts" ;
35
+ import { character } from "./character .ts" ;
36
36
import type { DirectClient } from "@ai16z/client-direct" ;
37
37
38
38
const __filename = fileURLToPath ( import . meta. url ) ; // get the resolved path to the file
@@ -263,6 +263,13 @@ export function createAgent(
263
263
} ) ;
264
264
}
265
265
266
+ function intializeFsCache ( baseDir : string , character : Character ) {
267
+ const cacheDir = path . resolve ( baseDir , character . id , "cache" ) ;
268
+
269
+ const cache = new CacheManager ( new FsCacheAdapter ( cacheDir ) ) ;
270
+ return cache ;
271
+ }
272
+
266
273
function intializeDbCache ( character : Character , db : IDatabaseCacheAdapter ) {
267
274
const cache = new CacheManager ( new DbCacheAdapter ( db , character . id ) ) ;
268
275
return cache ;
@@ -310,7 +317,7 @@ const startAgents = async () => {
310
317
311
318
let charactersArg = args . characters || args . character ;
312
319
313
- let characters = [ blobert ] ;
320
+ let characters = [ character ] ;
314
321
315
322
if ( charactersArg ) {
316
323
characters = await loadCharacters ( charactersArg ) ;
Original file line number Diff line number Diff line change @@ -736,7 +736,9 @@ export class PostgresDatabaseAdapter
736
736
) ;
737
737
738
738
if ( existingParticipant . rows . length > 0 ) {
739
- console . log ( `Participant with userId ${ userId } already exists in room ${ roomId } .` ) ;
739
+ console . log (
740
+ `Participant with userId ${ userId } already exists in room ${ roomId } .`
741
+ ) ;
740
742
return ; // Exit early if the participant already exists
741
743
}
742
744
@@ -750,11 +752,13 @@ export class PostgresDatabaseAdapter
750
752
} catch ( error ) {
751
753
// This is to prevent duplicate participant error in case of a race condition
752
754
// Handle unique constraint violation error (code 23505)
753
- if ( error . code === '23505' ) {
754
- console . warn ( `Participant with userId ${ userId } already exists in room ${ roomId } .` ) ; // Optionally, you can log this or handle it differently
755
+ if ( error . code === "23505" ) {
756
+ console . warn (
757
+ `Participant with userId ${ userId } already exists in room ${ roomId } .`
758
+ ) ; // Optionally, you can log this or handle it differently
755
759
} else {
756
760
// Handle other errors
757
- console . error ( ' Error adding participant:' , error ) ;
761
+ console . error ( " Error adding participant:" , error ) ;
758
762
return false ;
759
763
}
760
764
} finally {
You can’t perform that action at this time.
0 commit comments