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: postgres needs the user to exist before you can add a participant #1219

Merged
merged 2 commits into from
Dec 19, 2024
Merged
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 @@ -234,6 +234,10 @@

this.#conversationLength =
opts.conversationLength ?? this.#conversationLength;

if (!opts.databaseAdapter) {
throw new Error("No database adapter provided");
}

Check warning on line 240 in packages/core/src/runtime.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/runtime.ts#L238-L240

Added lines #L238 - L240 were not covered by tests
this.databaseAdapter = opts.databaseAdapter;
// use the character id if it exists, otherwise use the agentId if it is passed in, otherwise use the character name
this.agentId =
Expand All @@ -249,15 +253,14 @@
this.agentId,
this.character.name,
this.character.name
);
this.ensureParticipantExists(this.agentId, this.agentId);
).then(() => {

Check warning on line 256 in packages/core/src/runtime.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/runtime.ts#L256

Added line #L256 was not covered by tests
// postgres needs the user to exist before you can add a participant
this.ensureParticipantExists(this.agentId, this.agentId);
});

Check warning on line 259 in packages/core/src/runtime.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/runtime.ts#L258-L259

Added lines #L258 - L259 were not covered by tests

elizaLogger.success("Agent ID", this.agentId);

this.fetch = (opts.fetch as typeof fetch) ?? this.fetch;
if (!opts.databaseAdapter) {
throw new Error("No database adapter provided");
}

this.cacheManager = opts.cacheManager;

Expand Down
Loading