fix vector collection data issue
This commit is contained in:
parent
12077f0ebf
commit
d27e8fadf6
|
|
@ -3,8 +3,8 @@ namespace BotSharp.Abstraction.VectorStorage.Models;
|
|||
public class VectorCollectionData
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public Dictionary<string, VectorPayloadValue> Data { get; set; } = new();
|
||||
public Dictionary<string, object> Payload => Data?.ToDictionary(x => x.Key, x => x.Value.DataValue) ?? [];
|
||||
public Dictionary<string, VectorPayloadValue> Payload { get; set; } = new();
|
||||
public Dictionary<string, object> Data => Payload?.ToDictionary(x => x.Key, x => x.Value.DataValue) ?? [];
|
||||
public double? Score { get; set; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class VectorSearchResult : VectorCollectionData
|
|||
return new VectorSearchResult
|
||||
{
|
||||
Id = data.Id,
|
||||
Data = data.Data,
|
||||
Payload = data.Payload,
|
||||
Score = data.Score,
|
||||
Vector = data.Vector
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ public class VectorKnowledgeViewModel
|
|||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public IDictionary<string, VectorPayloadValue> Data { get; set; }
|
||||
|
||||
[JsonPropertyName("payload")]
|
||||
public IDictionary<string, object> Payload { get; set; }
|
||||
public IDictionary<string, VectorPayloadValue> Payload { get; set; }
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public IDictionary<string, object> Data { get; set; }
|
||||
|
||||
[JsonPropertyName("score")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class MemoryVectorDb : IVectorDb
|
|||
.Take(options.Limit.GetValueOrDefault())
|
||||
.Select(i => new VectorCollectionData
|
||||
{
|
||||
Data = new Dictionary<string, VectorPayloadValue>
|
||||
Payload = new Dictionary<string, VectorPayloadValue>
|
||||
{
|
||||
{ "text", new(_vectors[collectionName][i].Text, VectorPayloadDataType.String) }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public class QdrantDb : IVectorDb
|
|||
var points = response?.Result?.Select(x => new VectorCollectionData
|
||||
{
|
||||
Id = x.Id?.Uuid ?? string.Empty,
|
||||
Data = MapPayload(x.Payload),
|
||||
Payload = MapPayload(x.Payload),
|
||||
Vector = filter.WithVector ? x.Vectors?.Vector?.Data?.ToArray() : null
|
||||
})?.ToList() ?? new List<VectorCollectionData>();
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ public class QdrantDb : IVectorDb
|
|||
return points.Select(x => new VectorCollectionData
|
||||
{
|
||||
Id = x.Id?.Uuid ?? string.Empty,
|
||||
Data = MapPayload(x.Payload),
|
||||
Payload = MapPayload(x.Payload),
|
||||
Vector = x.Vectors?.Vector?.Data?.ToArray()
|
||||
});
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ public class QdrantDb : IVectorDb
|
|||
results = points.Select(x => new VectorCollectionData
|
||||
{
|
||||
Id = x.Id.Uuid,
|
||||
Data = MapPayload(x.Payload),
|
||||
Payload = MapPayload(x.Payload),
|
||||
Score = x.Score,
|
||||
Vector = x.Vectors?.Vector?.Data?.ToArray()
|
||||
}).ToList();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace BotSharp.Plugin.SemanticKernel
|
|||
{
|
||||
resultTexts.Add(new VectorCollectionData
|
||||
{
|
||||
Data = new Dictionary<string, VectorPayloadValue>
|
||||
Payload = new Dictionary<string, VectorPayloadValue>
|
||||
{
|
||||
{ "text", new(record.Metadata.Text, VectorPayloadDataType.String) }
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue