mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 20:52:11 +00:00
moved datasource indexing to lower level
This commit is contained in:
parent
b4e916e166
commit
202e37410b
@ -15,7 +15,7 @@
|
|||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Class="mb-3" Wrap="Wrap.Wrap">
|
<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">
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Sync" Disabled="@(!this.HasRefreshableDataSources())" OnClick="@this.RefreshAllDataSources">
|
||||||
@T("Refresh all")
|
@T("Refresh all")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public partial class SettingsDialogDataSources : SettingsDialogBase
|
|||||||
|
|
||||||
private async Task AutomaticRefreshChanged(bool enabled)
|
private async Task AutomaticRefreshChanged(bool enabled)
|
||||||
{
|
{
|
||||||
this.SettingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh = enabled;
|
this.SettingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh = enabled;
|
||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
this.DataSourceEmbeddingService.RefreshAutomaticWatchers();
|
this.DataSourceEmbeddingService.RefreshAutomaticWatchers();
|
||||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
|||||||
@ -129,8 +129,6 @@ public sealed class Data
|
|||||||
|
|
||||||
public DataAgentRetrievalContextValidation AgentRetrievalContextValidation { get; init; } = new(x => x.AgentRetrievalContextValidation);
|
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 DataAssistantPluginAudit AssistantPluginAudit { get; init; } = new(x => x.AssistantPluginAudit);
|
||||||
|
|
||||||
public DataAgenda Agenda { get; init; } = new();
|
public DataAgenda Agenda { get; init; } = new();
|
||||||
|
|||||||
@ -154,6 +154,11 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShowAdminSettings { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ShowAdminSettings, false);
|
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>
|
/// <summary>
|
||||||
/// List of assistants that should be hidden from the UI.
|
/// List of assistants that should be hidden from the UI.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public sealed partial class DataSourceEmbeddingService
|
|||||||
|
|
||||||
private void RefreshWatchers()
|
private void RefreshWatchers()
|
||||||
{
|
{
|
||||||
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
|
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
|
||||||
{
|
{
|
||||||
this.RemoveAllWatchers();
|
this.RemoveAllWatchers();
|
||||||
return;
|
return;
|
||||||
@ -41,7 +41,7 @@ public sealed partial class DataSourceEmbeddingService
|
|||||||
|
|
||||||
private void EnsureWatcher(IDataSource dataSource)
|
private void EnsureWatcher(IDataSource dataSource)
|
||||||
{
|
{
|
||||||
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
|
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var configuration = GetWatchConfiguration(dataSource);
|
var configuration = GetWatchConfiguration(dataSource);
|
||||||
@ -143,7 +143,7 @@ public sealed partial class DataSourceEmbeddingService
|
|||||||
|
|
||||||
private void ScheduleWatchedDataSourceRefresh(string dataSourceId)
|
private void ScheduleWatchedDataSourceRefresh(string dataSourceId)
|
||||||
{
|
{
|
||||||
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
|
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var debounceToken = new CancellationTokenSource();
|
var debounceToken = new CancellationTokenSource();
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
|||||||
|
|
||||||
public Task QueueAllInternalDataSourcesIfAutomaticRefreshAsync()
|
public Task QueueAllInternalDataSourcesIfAutomaticRefreshAsync()
|
||||||
{
|
{
|
||||||
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
|
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
|
||||||
{
|
{
|
||||||
this.RefreshWatchers();
|
this.RefreshWatchers();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
@ -148,7 +148,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
|||||||
|
|
||||||
public void RefreshAutomaticWatchers()
|
public void RefreshAutomaticWatchers()
|
||||||
{
|
{
|
||||||
if (!settingsManager.ConfigurationData.DataSourceIndexing.AutomaticRefresh)
|
if (!settingsManager.ConfigurationData.App.DataSourceIndexing.AutomaticRefresh)
|
||||||
{
|
{
|
||||||
Volatile.Write(ref this.startupHashCheckCompleted, 0);
|
Volatile.Write(ref this.startupHashCheckCompleted, 0);
|
||||||
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);
|
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);
|
||||||
@ -959,7 +959,7 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
|||||||
|
|
||||||
private async Task RunInitialDataSourceHashCheckAsync(CancellationToken token)
|
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.");
|
logger.LogInformation("Automatic local data source refresh is disabled. Startup hash checks and file watchers are disabled.");
|
||||||
this.RemoveAllWatchers();
|
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);
|
Volatile.Write(ref this.startupHashCheckCompleted, 0);
|
||||||
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);
|
Interlocked.Exchange(ref this.startupHashCheckStarted, 0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user