Skip to content

Commit

Permalink
优化搜索逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
239573049 committed Aug 18, 2024
1 parent c58fe57 commit 21bd79a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>0.1.8</Version>
<AssemblyVersion>0.1.8</AssemblyVersion>
<Version>0.1.9</Version>
<AssemblyVersion>0.1.9</AssemblyVersion>
<Authors>AIDotNet</Authors>
<Company>AIDotNet</Company>
<PackageId>$(AssemblyName)</PackageId>
Expand Down
5 changes: 0 additions & 5 deletions src/mem0.NET/Model/VectorData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,3 @@ public string? Text
}
} // 文本
}

public class VectorDataPayload
{
public string stringValue { get; set; }
}
7 changes: 7 additions & 0 deletions src/mem0.NET/Model/VectorDataPayload.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace mem0.Core.Model;


public class VectorDataPayload
{
public string stringValue { get; set; }
}
4 changes: 2 additions & 2 deletions src/mem0.NET/Services/MemoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ await vectorStoreService.SearchAsync(options.Value.CollectionName, embeddings.To
id = x.Id,
score = x.Score,
metaData = x.Payload,
text = x.Payload["data"]
text = JsonSerializer.Deserialize<VectorDataPayload>(x.Payload["data"].ToString()).stringValue
});

var serialized_existing_memories = existing_memories.Select(x => new
Expand All @@ -126,7 +126,7 @@ await vectorStoreService.SearchAsync(options.Value.CollectionName, embeddings.To

using var scope = serviceProvider.CreateScope();
var kernel = scope.ServiceProvider.GetService<Kernel>();

var content = await chatCompletionService.GetChatMessageContentAsync(chatHistory,
new OpenAIPromptExecutionSettings()
{
Expand Down
3 changes: 1 addition & 2 deletions src/mem0.NET/Services/MemoryToolService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public async Task UpdateMemoryAsync(Guid memoryId,
newMetadata[o.Key] = o.Value;
}
}



await vectorStoreService.UpdateAsync(options.Value.CollectionName, memoryId,
[..existingMemory.Vector.ToArray()], newMetadata);

Expand Down

0 comments on commit 21bd79a

Please sign in to comment.