diff --git a/agent/src/index.ts b/agent/src/index.ts index 6e7ca7486b..1d8f1c0817 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -32,7 +32,7 @@ import readline from "readline"; import yargs from "yargs"; import path from "path"; import { fileURLToPath } from "url"; -import blobert from "./blobert.ts"; +import { character } from "./character.ts"; import type { DirectClient } from "@ai16z/client-direct"; const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file @@ -263,6 +263,13 @@ export function createAgent( }); } +function intializeFsCache(baseDir: string, character: Character) { + const cacheDir = path.resolve(baseDir, character.id, "cache"); + + const cache = new CacheManager(new FsCacheAdapter(cacheDir)); + return cache; +} + function intializeDbCache(character: Character, db: IDatabaseCacheAdapter) { const cache = new CacheManager(new DbCacheAdapter(db, character.id)); return cache; @@ -310,7 +317,7 @@ const startAgents = async () => { let charactersArg = args.characters || args.character; - let characters = [blobert]; + let characters = [character]; if (charactersArg) { characters = await loadCharacters(charactersArg); diff --git a/packages/adapter-postgres/src/index.ts b/packages/adapter-postgres/src/index.ts index 23a4b426ae..701b8eafdc 100644 --- a/packages/adapter-postgres/src/index.ts +++ b/packages/adapter-postgres/src/index.ts @@ -736,7 +736,9 @@ export class PostgresDatabaseAdapter ); if (existingParticipant.rows.length > 0) { - console.log(`Participant with userId ${userId} already exists in room ${roomId}.`); + console.log( + `Participant with userId ${userId} already exists in room ${roomId}.` + ); return; // Exit early if the participant already exists } @@ -750,11 +752,13 @@ export class PostgresDatabaseAdapter } catch (error) { // This is to prevent duplicate participant error in case of a race condition // Handle unique constraint violation error (code 23505) - if (error.code === '23505') { - console.warn(`Participant with userId ${userId} already exists in room ${roomId}.`); // Optionally, you can log this or handle it differently + if (error.code === "23505") { + console.warn( + `Participant with userId ${userId} already exists in room ${roomId}.` + ); // Optionally, you can log this or handle it differently } else { // Handle other errors - console.error('Error adding participant:', error); + console.error("Error adding participant:", error); return false; } } finally {