mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 21:33:47 +00:00
Let people change the embedding of an indexed data source
This commit is contained in:
6 files changed
+88
-102
No files matched your search
@@ -199,12 +199,30 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
||||
this.CanRefreshDataSource(dataSource);
|
||||
}
|
||||
|
||||
public async Task<bool> ShouldLockDataSourceIdentityAsync(string dataSourceId, CancellationToken token = default)
|
||||
/// <summary>
|
||||
/// Whether the file or folder a data source reads must stay as it is.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Locked as soon as the index holds anything, because where a data source reads from is what it
|
||||
/// is: another folder is another data source, and the path reaches no signature, so swapping it
|
||||
/// would leave the stored index describing documents nobody points at any more.
|
||||
///
|
||||
/// The embedding provider used to be locked along with it and no longer is. It does reach the
|
||||
/// signature, so changing it rebuilds the index cleanly -- and DataSourceReindexWarning asks
|
||||
/// before it does. Locking it as well left a data source whose provider was deleted stuck on
|
||||
/// keyword search for good, with no way back.
|
||||
///
|
||||
/// Unclear counts as locked: an unavailable index database says nothing about what is stored.
|
||||
/// </remarks>
|
||||
/// <param name="dataSourceId">The data source to ask about.</param>
|
||||
/// <param name="token">The cancellation token.</param>
|
||||
/// <returns>True when the source must not be changed.</returns>
|
||||
public async Task<bool> ShouldLockDataSourceOriginAsync(string dataSourceId, CancellationToken token = default)
|
||||
{
|
||||
var indexStore = await databaseClientProvider.GetIndexStoreAsync(token);
|
||||
if (!indexStore.IsAvailable)
|
||||
{
|
||||
logger.LogWarning("Locking identity settings for data source '{DataSourceId}' because the local RAG index database '{DatabaseName}' is unavailable.", dataSourceId, indexStore.Name);
|
||||
logger.LogWarning("Locking the source of data source '{DataSourceId}' because the local RAG index database '{DatabaseName}' is unavailable.", dataSourceId, indexStore.Name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user