diff --git a/app/MindWork AI Studio/Components/DataSourceSelection.razor b/app/MindWork AI Studio/Components/DataSourceSelection.razor
index 29c0d709..c5f1be6c 100644
--- a/app/MindWork AI Studio/Components/DataSourceSelection.razor
+++ b/app/MindWork AI Studio/Components/DataSourceSelection.razor
@@ -160,13 +160,13 @@ else if (this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE)
}
-
+
@if (this.areDataSourcesEnabled)
{
-
-
-
- this.SelectionChanged(x))">
+
+
+
+ this.SelectionChanged(x))" ReadOnly="@this.IsPreselectedDataSourceIdsLocked()">
@foreach (var source in this.availableDataSources)
{
diff --git a/app/MindWork AI Studio/Components/DataSourceSelection.razor.cs b/app/MindWork AI Studio/Components/DataSourceSelection.razor.cs
index eeb340c5..c95dc554 100644
--- a/app/MindWork AI Studio/Components/DataSourceSelection.razor.cs
+++ b/app/MindWork AI Studio/Components/DataSourceSelection.razor.cs
@@ -231,6 +231,34 @@ public partial class DataSourceSelection : MSGComponentBase
await this.OptionsChanged();
}
+ private bool IsPreselectedDataSourcesDisabledLocked()
+ {
+ return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
+ && ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesDisabled, out var meta)
+ && meta.IsLocked;
+ }
+
+ private bool IsPreselectedDataSourcesAutomaticSelectionLocked()
+ {
+ return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
+ && ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesAutomaticSelection, out var meta)
+ && meta.IsLocked;
+ }
+
+ private bool IsPreselectedDataSourcesAutomaticValidationLocked()
+ {
+ return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
+ && ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesAutomaticValidation, out var meta)
+ && meta.IsLocked;
+ }
+
+ private bool IsPreselectedDataSourceIdsLocked()
+ {
+ return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
+ && ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourceIds, out var meta)
+ && meta.IsLocked;
+ }
+
private async Task OptionsChanged()
{
this.internalChange = true;
diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentDataSourceSelection.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentDataSourceSelection.razor
index e4b258cb..6e951c24 100644
--- a/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentDataSourceSelection.razor
+++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentDataSourceSelection.razor
@@ -1,3 +1,4 @@
+@using AIStudio.Settings
@inherits SettingsPanelBase
@@ -5,7 +6,7 @@
@T("Use Case: this agent is used to select the appropriate data sources for the current prompt.")
-
-
+
+
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentRetrievalContextValidation.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentRetrievalContextValidation.razor
index 061c3585..e6bcb880 100644
--- a/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentRetrievalContextValidation.razor
+++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelAgentRetrievalContextValidation.razor
@@ -1,16 +1,17 @@
+@using AIStudio.Settings
@inherits SettingsPanelBase
@T("Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model.")
-
+
@if (this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
{
-
-
-
+
+
+
}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChat.razor b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChat.razor
index 348f7a53..f80fa857 100644
--- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChat.razor
+++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChat.razor
@@ -25,7 +25,7 @@
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
-
+
}
diff --git a/app/MindWork AI Studio/Plugins/configuration/plugin.lua b/app/MindWork AI Studio/Plugins/configuration/plugin.lua
index b8690ff4..90cc0e1d 100644
--- a/app/MindWork AI Studio/Plugins/configuration/plugin.lua
+++ b/app/MindWork AI Studio/Plugins/configuration/plugin.lua
@@ -270,12 +270,38 @@ CONFIG["SETTINGS"] = {}
-- Please note: using an empty string ("") or "00000000-0000-0000-0000-000000000000" means chats will use no chat template.
-- CONFIG["SETTINGS"]["DataChat.PreselectedChatTemplate"] = "00000000-0000-0000-0000-000000000000"
--
+--
+-- Configure default data source options for new chats.
+--
+-- Controls whether data sources are off by default:
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesDisabled"] = false
+
+-- Controls whether AI Studio asks an agent to choose data sources:
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesAutomaticSelection"] = true
+
+-- Controls whether retrieved data is validated by an agent:
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesAutomaticValidation"] = true
+
+-- Must contain IDs from CONFIG["DATA_SOURCES"] or user-configured data sources.
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourceIds"] = {
+-- "00000000-0000-0000-0000-000000000000",
+-- }
+--
+-- Configure whether default chat data source options are applied when assistant results are sent to chat.
+-- Allowed values are: NO_DATA_SOURCES, APPLY_STANDARD_CHAT_DATA_SOURCE_OPTIONS
+-- CONFIG["SETTINGS"]["DataChat.SendToChatDataSourceBehavior"] = "APPLY_STANDARD_CHAT_DATA_SOURCE_OPTIONS"
+--
-- Allow users to change any configured chat default locally.
-- Allowed values are: true, false
-- CONFIG["SETTINGS"]["DataChat.PreselectOptions.AllowUserOverride"] = true
-- CONFIG["SETTINGS"]["DataChat.PreselectedProvider.AllowUserOverride"] = true
-- CONFIG["SETTINGS"]["DataChat.PreselectedProfile.AllowUserOverride"] = true
-- CONFIG["SETTINGS"]["DataChat.PreselectedChatTemplate.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesDisabled.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesAutomaticSelection.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourcesAutomaticValidation.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataChat.PreselectedDataSourceIds.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataChat.SendToChatDataSourceBehavior.AllowUserOverride"] = true
-- Configure the transcription provider for voice-to-text functionality.
-- It must be one of the transcription provider IDs defined in CONFIG["TRANSCRIPTION_PROVIDERS"].
@@ -386,6 +412,26 @@ CONFIG["SETTINGS"] = {}
-- "00000000-0000-0000-0000-000000000001",
-- }
+-- Configure the data source selection agent.
+-- This agent is used when chat data source options enable AI-based data source selection.
+-- The provider must be one of the provider IDs defined in CONFIG["LLM_PROVIDERS"].
+-- CONFIG["SETTINGS"]["DataAgentDataSourceSelection.PreselectAgentOptions"] = true
+-- CONFIG["SETTINGS"]["DataAgentDataSourceSelection.PreselectedAgentProvider"] = "00000000-0000-0000-0000-000000000000"
+-- CONFIG["SETTINGS"]["DataAgentDataSourceSelection.PreselectAgentOptions.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataAgentDataSourceSelection.PreselectedAgentProvider.AllowUserOverride"] = true
+
+-- Configure the retrieval context validation agent.
+-- This agent is used when retrieval context validation is enabled globally and chat data source options enable AI-based validation.
+-- The provider must be one of the provider IDs defined in CONFIG["LLM_PROVIDERS"].
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.EnableRetrievalContextValidation"] = true
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.PreselectAgentOptions"] = true
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.PreselectedAgentProvider"] = "00000000-0000-0000-0000-000000000000"
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.NumParallelValidations"] = 3
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.EnableRetrievalContextValidation.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.PreselectAgentOptions.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.PreselectedAgentProvider.AllowUserOverride"] = true
+-- CONFIG["SETTINGS"]["DataAgentRetrievalContextValidation.NumParallelValidations.AllowUserOverride"] = true
+
-- Configure assistant plugin security audits.
--
-- Configure whether assistant plugins must be audited before users can activate them.
diff --git a/app/MindWork AI Studio/Settings/DataModel/Data.cs b/app/MindWork AI Studio/Settings/DataModel/Data.cs
index 07f9f9e2..327301b7 100644
--- a/app/MindWork AI Studio/Settings/DataModel/Data.cs
+++ b/app/MindWork AI Studio/Settings/DataModel/Data.cs
@@ -125,9 +125,9 @@ public sealed class Data
public DataTextContentCleaner TextContentCleaner { get; init; } = new();
- public DataAgentDataSourceSelection AgentDataSourceSelection { get; init; } = new();
+ public DataAgentDataSourceSelection AgentDataSourceSelection { get; init; } = new(x => x.AgentDataSourceSelection);
- public DataAgentRetrievalContextValidation AgentRetrievalContextValidation { get; init; } = new();
+ public DataAgentRetrievalContextValidation AgentRetrievalContextValidation { get; init; } = new(x => x.AgentRetrievalContextValidation);
public DataAssistantPluginAudit AssistantPluginAudit { get; init; } = new(x => x.AssistantPluginAudit);
diff --git a/app/MindWork AI Studio/Settings/DataModel/DataAgentDataSourceSelection.cs b/app/MindWork AI Studio/Settings/DataModel/DataAgentDataSourceSelection.cs
index 55473dcc..1e2ad3d2 100644
--- a/app/MindWork AI Studio/Settings/DataModel/DataAgentDataSourceSelection.cs
+++ b/app/MindWork AI Studio/Settings/DataModel/DataAgentDataSourceSelection.cs
@@ -1,14 +1,23 @@
+using System.Linq.Expressions;
+
namespace AIStudio.Settings.DataModel;
-public sealed class DataAgentDataSourceSelection
+public sealed class DataAgentDataSourceSelection(Expression>? configSelection = null)
{
+ ///
+ /// The default constructor for the JSON deserializer.
+ ///
+ public DataAgentDataSourceSelection() : this(null)
+ {
+ }
+
///
/// Preselect any data source selection options?
///
- public bool PreselectAgentOptions { get; set; }
+ public bool PreselectAgentOptions { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectAgentOptions, false);
///
/// Preselect a data source selection provider?
///
- public string PreselectedAgentProvider { get; set; } = string.Empty;
+ public string PreselectedAgentProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedAgentProvider, string.Empty);
}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Settings/DataModel/DataAgentRetrievalContextValidation.cs b/app/MindWork AI Studio/Settings/DataModel/DataAgentRetrievalContextValidation.cs
index a4ae0a8f..93ae50dd 100644
--- a/app/MindWork AI Studio/Settings/DataModel/DataAgentRetrievalContextValidation.cs
+++ b/app/MindWork AI Studio/Settings/DataModel/DataAgentRetrievalContextValidation.cs
@@ -1,24 +1,33 @@
+using System.Linq.Expressions;
+
namespace AIStudio.Settings.DataModel;
-public sealed class DataAgentRetrievalContextValidation
+public sealed class DataAgentRetrievalContextValidation(Expression>? configSelection = null)
{
+ ///
+ /// The default constructor for the JSON deserializer.
+ ///
+ public DataAgentRetrievalContextValidation() : this(null)
+ {
+ }
+
///
/// Enable the retrieval context validation agent?
///
- public bool EnableRetrievalContextValidation { get; set; }
+ public bool EnableRetrievalContextValidation { get; set; } = ManagedConfiguration.Register(configSelection, n => n.EnableRetrievalContextValidation, false);
///
/// Preselect any retrieval context validation options?
///
- public bool PreselectAgentOptions { get; set; }
+ public bool PreselectAgentOptions { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectAgentOptions, false);
///
/// Preselect a retrieval context validation provider?
///
- public string PreselectedAgentProvider { get; set; } = string.Empty;
+ public string PreselectedAgentProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedAgentProvider, string.Empty);
///
/// Configure how many parallel validations to run.
///
- public int NumParallelValidations { get; set; } = 3;
+ public int NumParallelValidations { get; set; } = ManagedConfiguration.Register(configSelection, n => n.NumParallelValidations, 3);
}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Settings/DataModel/DataChat.cs b/app/MindWork AI Studio/Settings/DataModel/DataChat.cs
index f2a7ea37..67b3b313 100644
--- a/app/MindWork AI Studio/Settings/DataModel/DataChat.cs
+++ b/app/MindWork AI Studio/Settings/DataModel/DataChat.cs
@@ -29,7 +29,7 @@ public sealed class DataChat(Expression>? configSelection =
///
/// Defines the data source behavior when sending assistant results to a chat.
///
- public SendToChatDataSourceBehavior SendToChatDataSourceBehavior { get; set; } = SendToChatDataSourceBehavior.NO_DATA_SOURCES;
+ public SendToChatDataSourceBehavior SendToChatDataSourceBehavior { get; set; } = ManagedConfiguration.Register(configSelection, n => n.SendToChatDataSourceBehavior, SendToChatDataSourceBehavior.NO_DATA_SOURCES);
///
/// Preselect any chat options?
@@ -51,10 +51,47 @@ public sealed class DataChat(Expression>? configSelection =
///
public string PreselectedChatTemplate { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedChatTemplate, string.Empty);
+ ///
+ /// Whether data sources are disabled by default for new chats.
+ ///
+ public bool PreselectedDataSourcesDisabled { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesDisabled, true);
+
+ ///
+ /// Whether data sources should be selected automatically by default for new chats.
+ ///
+ public bool PreselectedDataSourcesAutomaticSelection { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesAutomaticSelection, false);
+
+ ///
+ /// Whether retrieved data should be validated automatically by default for new chats.
+ ///
+ public bool PreselectedDataSourcesAutomaticValidation { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourcesAutomaticValidation, false);
+
+ ///
+ /// The data source IDs that should be preselected by default for new chats.
+ ///
+ public List PreselectedDataSourceIds { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedDataSourceIds, []);
+
///
/// Should we preselect data sources options for a created chat?
///
- public DataSourceOptions PreselectedDataSourceOptions { get; set; } = new();
+ // Compatibility shim: legacy settings used this nested object. See documentation/compatibility-shims/2026-07-chat-data-source-options.md; remove after 2027-01-05.
+ public DataSourceOptions PreselectedDataSourceOptions
+ {
+ get => new()
+ {
+ DisableDataSources = this.PreselectedDataSourcesDisabled,
+ AutomaticDataSourceSelection = this.PreselectedDataSourcesAutomaticSelection,
+ AutomaticValidation = this.PreselectedDataSourcesAutomaticValidation,
+ PreselectedDataSourceIds = [..this.PreselectedDataSourceIds],
+ };
+ set
+ {
+ this.PreselectedDataSourcesDisabled = value.DisableDataSources;
+ this.PreselectedDataSourcesAutomaticSelection = value.AutomaticDataSourceSelection;
+ this.PreselectedDataSourcesAutomaticValidation = value.AutomaticValidation;
+ this.PreselectedDataSourceIds = [..value.PreselectedDataSourceIds];
+ }
+ }
///
/// Should we show the latest message after loading? When false, we show the first (aka oldest) message.
diff --git a/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs b/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs
index e44fc8dc..2aea5f96 100644
--- a/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs
+++ b/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs
@@ -435,7 +435,9 @@ public static partial class ManagedConfiguration
if(dryRun)
return successful;
- return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
+ var settingName = SettingName(propertyExpression);
+ var managedMode = ReadManagedConfigurationMode(propertyExpression, settings);
+ return HandleParsedScalarValue(configPluginId, dryRun, successful, configMeta, configuredValue, managedMode, settingName);
}
///
@@ -1026,6 +1028,10 @@ public static partial class ManagedConfiguration
.Cast