Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): update ensureUserExists method: avoid possible TypeError: Converting circular structure to JSON occurred by doing JSON.stringify for charactor.plugins #3235

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ export class AgentRuntime implements IAgentRuntime {

this.imageModelProvider =
this.character.imageModelProvider ?? this.modelProvider;

this.imageVisionModelProvider =
this.character.imageVisionModelProvider ?? this.modelProvider;

elizaLogger.info(
`${this.character.name}(${this.agentId}) - Selected model provider:`,
this.modelProvider
Expand Down Expand Up @@ -1168,7 +1168,10 @@ export class AgentRuntime implements IAgentRuntime {
name: name || this.character.name || "Unknown User",
username: userName || this.character.username || "Unknown",
email: email || this.character.email || userId, // Temporary
details: this.character || { summary: "" },
details: this.character ? Object.assign({}, this.character, {
source,
plugins: this.character?.plugins?.map((plugin) => plugin.name),
}) : { summary: "" },
});
elizaLogger.success(`User ${userName} created successfully.`);
}
Expand Down Expand Up @@ -1776,12 +1779,12 @@ const formatKnowledge = (knowledge: KnowledgeItem[]) => {
return knowledge.map(item => {
// Get the main content text
const text = item.content.text;

// Clean up formatting but maintain natural text flow
const cleanedText = text
.trim()
.replace(/\n{3,}/g, '\n\n'); // Replace excessive newlines

return cleanedText;
}).join('\n\n'); // Separate distinct pieces with double newlines
};
Loading