Files
AI-Studio/app/MindWork AI Studio/Tools/Services/DataSourceEmbeddingService.State.cs
T

26 lines
1.0 KiB
C#
Raw Normal View History

using AIStudio.Tools.Databases.IndexStore;
using AIStudio.Tools.Databases.VectorStore;
2026-05-13 18:13:34 +02:00
namespace AIStudio.Tools.Services;
public sealed partial class DataSourceEmbeddingService
{
2026-07-28 15:25:10 +02:00
private async Task ResetPersistedStateAsync(
string dataSourceId,
VectorStoreClient? vectorStore,
IndexStoreClient? indexStore,
2026-07-28 15:25:10 +02:00
CancellationToken token)
2026-05-13 18:13:34 +02:00
{
await this.DeleteCollectionAsync(DataSourceEmbeddingNames.GetCollectionName(dataSourceId), vectorStore, token);
2026-05-13 18:13:34 +02:00
indexStore ??= await databaseClientProvider.GetIndexStoreAsync(token);
if (!indexStore.IsAvailable)
2026-05-13 18:13:34 +02:00
{
logger.LogWarning("Could not delete local RAG embedding state for data source '{DataSourceId}' because the database '{DatabaseName}' is unavailable.", dataSourceId, indexStore.Name);
2026-05-13 18:13:34 +02:00
return;
2026-07-28 15:25:10 +02:00
}
2026-05-13 18:13:34 +02:00
await indexStore.DeleteDataSourceAsync(dataSourceId, token);
logger.LogInformation("Reset persisted local RAG embedding state for data source '{DataSourceId}'.", dataSourceId);
2026-05-13 18:13:34 +02:00
}
}