Skip to content

Commit

Permalink
fix service registry
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Mar 4, 2025
1 parent a120874 commit 259c7b6
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 125 deletions.
16 changes: 11 additions & 5 deletions packages/agent/src/server/api/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,21 @@ export function agentRouter(
worldId,
});

await runtime.databaseAdapter.createRelationship({
const existingRelationship = await runtime.databaseAdapter.getRelationship({
sourceEntityId: userId,
targetEntityId: runtime.agentId,
tags: ["message_interaction"],
metadata: {
});
if (!existingRelationship) {
await runtime.databaseAdapter.createRelationship({
sourceEntityId: userId,
targetEntityId: runtime.agentId,
tags: ["message_interaction"],
metadata: {
lastInteraction: Date.now(),
channel: "direct"
}
});
}
});
}

const messageId = createUniqueUuid(runtime, Date.now().toString());
const attachments: Media[] = [];
Expand Down
Loading

0 comments on commit 259c7b6

Please sign in to comment.