Skip to content

Commit

Permalink
fix bad embedding check
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Nov 13, 2024
1 parent 1260b33 commit 3a3d9e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ export class MemoryManager implements IMemoryManager {
async createMemory(memory: Memory, unique = false): Promise<void> {
const existingMessage =
await this.runtime.databaseAdapter.getMemoryById(memory.id);

console.log("existingMessage", existingMessage);

if (existingMessage) {
console.log("Memory already exists, skipping");
return;
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ export class AgentRuntime implements IAgentRuntime {

for (const knowledgeItem of knowledge) {
const knowledgeId = stringToUuid(knowledgeItem);
console.log("knowledgeId", knowledgeId);
const existingDocument =
await this.documentsManager.getMemoryById(knowledgeId);
console.log("existingDocument", existingDocument);
if (!existingDocument) {
console.log(
"Processing knowledge for ",
Expand Down Expand Up @@ -895,6 +897,8 @@ Text: ${attachment.text}
async function getKnowledge(runtime: AgentRuntime, message: Memory): Promise<string[]> {
const embedding = await embed(runtime, message.content.text);

console.log("message.agentId", message.agentId)

const memories = await runtime.knowledgeManager.searchMemoriesByEmbedding(
embedding,
{
Expand Down

0 comments on commit 3a3d9e7

Please sign in to comment.