remove data source

This commit is contained in:
Jicheng Lu 2025-08-15 12:00:40 -05:00
parent c212fbb4d6
commit 3d5f647d79
4 changed files with 4 additions and 12 deletions

View file

@ -5,6 +5,5 @@ namespace BotSharp.Abstraction.VectorStorage.Models;
public class VectorCreateModel
{
public string Text { get; set; }
public string DataSource { get; set; } = VectorDataSource.Api;
public Dictionary<string, VectorPayloadValue>? Payload { get; set; }
}

View file

@ -96,7 +96,6 @@ public class KnowledgeBaseController : ControllerBase
var create = new VectorCreateModel
{
Text = request.Text,
DataSource = request.DataSource,
Payload = request.Payload
};
@ -124,7 +123,6 @@ public class KnowledgeBaseController : ControllerBase
{
Id = request.Id,
Text = request.Text,
DataSource = request.DataSource,
Payload = request.Payload
};

View file

@ -8,9 +8,6 @@ public class VectorKnowledgeCreateRequest
[JsonPropertyName("text")]
public string Text { get; set; }
[JsonPropertyName("data_source")]
public string DataSource { get; set; } = string.Empty;
[JsonPropertyName("payload")]
public Dictionary<string, VectorPayloadValue>? Payload { get; set; }
}

View file

@ -169,8 +169,7 @@ public partial class KnowledgeService
if (!payload.TryGetValue(KnowledgePayloadName.DataSource, out _))
{
var dataSource = !string.IsNullOrWhiteSpace(create.DataSource) ? create.DataSource : VectorDataSource.Api;
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(dataSource);
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(VectorDataSource.Api);
}
return await db.Upsert(collectionName, guid, vector, create.Text, payload);
@ -206,8 +205,8 @@ public partial class KnowledgeService
if (!payload.TryGetValue(KnowledgePayloadName.DataSource, out _))
{
var dataSource = !string.IsNullOrWhiteSpace(update.DataSource) ? update.DataSource : VectorDataSource.Api;
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(dataSource);
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(VectorDataSource.Api);
}
return await db.Upsert(collectionName, guid, vector, update.Text, payload);
@ -247,8 +246,7 @@ public partial class KnowledgeService
if (!payload.TryGetValue(KnowledgePayloadName.DataSource, out _))
{
var dataSource = !string.IsNullOrWhiteSpace(update.DataSource) ? update.DataSource : VectorDataSource.Api;
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(dataSource);
payload[KnowledgePayloadName.DataSource] = VectorPayloadValue.BuildStringValue(VectorDataSource.Api);
}
return await db.Upsert(collectionName, guid, vector, update.Text, payload);