diff --git a/src/lib/actions/__tests__/elaborate.test.ts b/src/lib/actions/__tests__/elaborate.test.ts index 02d396c..688deff 100644 --- a/src/lib/actions/__tests__/elaborate.test.ts +++ b/src/lib/actions/__tests__/elaborate.test.ts @@ -192,7 +192,6 @@ describe("User Profile", () => { // Check if the agent used the ELABORATE action for each part const usedElaborateAction = elaborateMessages.length === 3; - console.log("**** agentMessages are ", agentMessages); // Check if the agent's responses are not empty const responsesNotEmpty = agentMessages.every( (m) => (m.content as Content).content !== "", diff --git a/src/lib/adapters/sqlite.ts b/src/lib/adapters/sqlite.ts index b74bb9e..7913166 100644 --- a/src/lib/adapters/sqlite.ts +++ b/src/lib/adapters/sqlite.ts @@ -77,9 +77,6 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { sql += " AND `unique` = 1"; } - console.log("***** sql", sql); - console.log("***** queryParams", queryParams); - return this.db.prepare(sql).all(...queryParams) as Memory[]; } @@ -141,8 +138,6 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { unique?: boolean; tableName: string; }): Promise { - console.log("***** params", params); - if (!params.tableName) { throw new Error("tableName is required"); } @@ -162,10 +157,11 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { queryParams.push(params.count.toString()); } - console.log("***** sql", sql); - console.log("***** queryParams", queryParams); - - return this.db.prepare(sql).all(...queryParams) as Memory[]; + const memories = this.db.prepare(sql).all(...queryParams) as Memory[]; + return memories.map((memory) => ({ + ...memory, + content: JSON.parse(memory.content as unknown as string), + })); } async searchMemoriesByEmbedding( @@ -204,9 +200,6 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { queryParams.push(params.count.toString()); } - console.log("***** sql", sql); - console.log("***** queryParams", queryParams); - return this.db.prepare(sql).all(...queryParams) as Memory[]; } @@ -216,18 +209,16 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { unique = false, ): Promise { const sql = `INSERT INTO memories (id, type, created_at, content, embedding, user_id, room_id, \`unique\`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`; - this.db - .prepare(sql) - .run( - memory.id, - tableName, - memory.created_at, - JSON.stringify(memory.content), - JSON.stringify(memory.embedding), - memory.user_id, - memory.room_id, - unique ? 1 : 0, - ); + this.db.prepare(sql).run( + memory.id, + tableName, + memory.created_at, + JSON.stringify(memory.content), // stringify the content field + JSON.stringify(memory.embedding), + memory.user_id, + memory.room_id, + unique ? 1 : 0, + ); } async removeMemory(memoryId: UUID, tableName: string): Promise { @@ -393,8 +384,7 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter { } async getRelationships(params: { userId: UUID }): Promise { - const sql = - "SELECT * FROM relationships WHERE (user_a = ? OR user_b = ?) AND status = 'FRIENDS'"; + const sql = "SELECT * FROM relationships WHERE (user_a = ? OR user_b = ?)"; return this.db .prepare(sql) .all(params.userId, params.userId) as Relationship[];