Skip to content

Commit 6f40883

Browse files
committed
update runtime to handle ensureUserExists in edge cases
1 parent 51050d1 commit 6f40883

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/core/src/runtime.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,14 @@ export class AgentRuntime implements IAgentRuntime {
11891189
id: userId,
11901190
name: name || this.character.name || "Unknown User",
11911191
username: userName || this.character.username || "Unknown",
1192-
email: email || this.character.email || userId, // Temporary
1193-
details: this.character || { summary: "" },
1192+
// TODO: We might not need these account pieces
1193+
email: email || this.character.email || userId,
1194+
// When invoke ensureUserExists and saving account.details
1195+
// Performing a complete JSON.stringify on character will cause a TypeError: Converting circular structure to JSON error in some more complex plugins.
1196+
details: this.character ? Object.assign({}, this.character, {
1197+
source,
1198+
plugins: this.character?.plugins?.map((plugin) => plugin.name),
1199+
}) : { summary: "" },
11941200
});
11951201
elizaLogger.success(`User ${userName} created successfully.`);
11961202
}

0 commit comments

Comments
 (0)