moved datasource indexing to lower level

This commit is contained in:
Paul Koudelka 2026-08-10 23:12:55 +02:00
parent b4e916e166
commit 202e37410b
6 changed files with 14 additions and 11 deletions

View File

@ -15,7 +15,7 @@
</MudJustifiedText>
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Class="mb-3" Wrap="Wrap.Wrap">
<MudTextSwitch Label="@T("Automatic local data source refresh")" Value="@this.SettingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh" LabelOn="@T("Local data sources refresh when files change.")" LabelOff="@T("Local data sources refresh only when triggered manually.")" ValueChanged="@this.AutomaticRefreshChanged"/>
<MudTextSwitch Label="@T("Automatic local data source refresh")" Value="@this.SettingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh" LabelOn="@T("Local data sources refresh when files change.")" LabelOff="@T("Local data sources refresh only when triggered manually.")" ValueChanged="@this.AutomaticRefreshChanged"/>
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Sync" Disabled="@(!this.HasRefreshableDataSources())" OnClick="@this.RefreshAllDataSources">
@T("Refresh all")
</MudButton>

View File

@ -41,7 +41,7 @@ public partial class SettingsDialogDataSources : SettingsDialogBase
private async Task AutomaticRefreshChanged(bool enabled)
{
this.SettingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh = enabled;
this.SettingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh = enabled;
await this.SettingsManager.StoreSettings();
this.DataSourceEmbeddingService.RefreshAutomaticWatchers();
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);

View File

@ -129,8 +129,6 @@ public sealed class Data
public DataAgentRetrievalContextValidation AgentRetrievalContextValidation { get; init; } = new(x => x.AgentRetrievalContextValidation);
public DataDataSourceIndexing DataSourceIndexing { get; init; } = new();
public DataAssistantPluginAudit AssistantPluginAudit { get; init; } = new(x => x.AssistantPluginAudit);
public DataAgenda Agenda { get; init; } = new();

View File

@ -154,6 +154,11 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
/// </summary>
public bool ShowAdminSettings { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ShowAdminSettings, false);
/// <summary>
/// Settings for indexing local data sources.
/// </summary>
public DataDataSourceIndexing DataSourceIndexing { get; init; } = new();
/// <summary>
/// List of assistants that should be hidden from the UI.
/// </summary>

View File

@ -15,7 +15,7 @@ public sealed partial class DataSourceEmbeddingService
private void RefreshWatchers()
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
{
this.RemoveAllWatchers();
return;
@ -41,7 +41,7 @@ public sealed partial class DataSourceEmbeddingService
private void EnsureWatcher(IDataSource dataSource)
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
return;
var configuration = GetWatchConfiguration(dataSource);
@ -143,7 +143,7 @@ public sealed partial class DataSourceEmbeddingService
private void ScheduleWatchedDataSourceRefresh(string dataSourceId)
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
return;
var debounceToken = new CancellationTokenSource();

View File

@ -136,7 +136,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
public Task QueueAllInternalDataSourcesIfAutomaticRefreshAsync()
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
{
this.RefreshWatchers();
return Task.CompletedTask;
@ -148,7 +148,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
public void RefreshAutomaticWatchers()
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
{
Volatile.Write(ref this.startupHashCheckCompleted, 0);
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);
@ -959,7 +959,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
private async Task RunInitialDataSourceHashCheckAsync(CancellationToken token)
{
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
{
logger.LogInformation("Automatic local data source refresh is disabled. Startup hash checks and file watchers are disabled.");
this.RemoveAllWatchers();
@ -997,7 +997,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
}
}
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
{
Volatile.Write(ref this.startupHashCheckCompleted, 0);
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);