mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 19:53:48 +00:00
Pick tools and data sources while editing a chat template
This commit is contained in:
5 files changed
+100
-6
No files matched your search
@@ -179,13 +179,13 @@ else if (this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE)
|
||||
</MudText>
|
||||
}
|
||||
|
||||
<MudTextSwitch Label="@T("Are data sources enabled?")" Value="@this.areDataSourcesEnabled" LabelOn="@T("Yes, I want to use data sources.")" LabelOff="@T("No, I don't want to use data sources.")" ValueChanged="@this.EnabledChanged" Disabled="@this.IsPreselectedDataSourcesDisabledLocked()"/>
|
||||
<MudTextSwitch Label="@T("Are data sources enabled?")" Value="@this.areDataSourcesEnabled" LabelOn="@T("Yes, I want to use data sources.")" LabelOff="@T("No, I don't want to use data sources.")" ValueChanged="@this.EnabledChanged" Disabled="@(this.ReadOnly || this.IsPreselectedDataSourcesDisabledLocked())"/>
|
||||
@if (this.areDataSourcesEnabled)
|
||||
{
|
||||
<MudTextSwitch Label="@T("AI-based data source selection")" Value="@this.aiBasedSourceSelection" LabelOn="@T("Yes, let the AI decide which data sources are needed.")" LabelOff="@T("No, I manually decide which data source to use.")" ValueChanged="@this.AutoModeChanged" Disabled="@this.IsPreselectedDataSourcesAutomaticSelectionLocked()"/>
|
||||
<MudTextSwitch Label="@T("AI-based data validation")" Value="@this.aiBasedValidation" LabelOn="@T("Yes, let the AI validate & filter the retrieved data.")" LabelOff="@T("No, use all data retrieved from the data sources.")" ValueChanged="@this.ValidationModeChanged" Disabled="@this.IsPreselectedDataSourcesAutomaticValidationLocked()"/>
|
||||
<MudField Label="@T("Available Data Sources")" Variant="Variant.Outlined" Class="mb-3" Disabled="@(this.aiBasedSourceSelection || this.IsPreselectedDataSourceIdsLocked())">
|
||||
<MudList T="IDataSource" Dense="@true" Class="data-source-rows" SelectionMode="@this.GetListSelectionMode()" @bind-SelectedValues:get="@this.selectedDataSources" @bind-SelectedValues:set="@(x => this.SelectionChanged(x))" ReadOnly="@this.IsPreselectedDataSourceIdsLocked()">
|
||||
<MudTextSwitch Label="@T("AI-based data source selection")" Value="@this.aiBasedSourceSelection" LabelOn="@T("Yes, let the AI decide which data sources are needed.")" LabelOff="@T("No, I manually decide which data source to use.")" ValueChanged="@this.AutoModeChanged" Disabled="@(this.ReadOnly || this.IsPreselectedDataSourcesAutomaticSelectionLocked())"/>
|
||||
<MudTextSwitch Label="@T("AI-based data validation")" Value="@this.aiBasedValidation" LabelOn="@T("Yes, let the AI validate & filter the retrieved data.")" LabelOff="@T("No, use all data retrieved from the data sources.")" ValueChanged="@this.ValidationModeChanged" Disabled="@(this.ReadOnly || this.IsPreselectedDataSourcesAutomaticValidationLocked())"/>
|
||||
<MudField Label="@T("Available Data Sources")" Variant="Variant.Outlined" Class="mb-3" Disabled="@(this.ReadOnly || this.aiBasedSourceSelection || this.IsPreselectedDataSourceIdsLocked())">
|
||||
<MudList T="IDataSource" Dense="@true" Class="data-source-rows" SelectionMode="@this.GetListSelectionMode()" @bind-SelectedValues:get="@this.selectedDataSources" @bind-SelectedValues:set="@(x => this.SelectionChanged(x))" ReadOnly="@(this.ReadOnly || this.IsPreselectedDataSourceIdsLocked())">
|
||||
@*
|
||||
The configuration mode lists what was configured, without filtering it, so no
|
||||
row here is ever waiting for an index.
|
||||
|
||||
@@ -38,7 +38,28 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
|
||||
[Parameter]
|
||||
public bool AutoSaveAppSettings { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Shows the options without letting the user change them.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For options somebody else decided on, such as those of a chat template an organization
|
||||
/// rolled out. Seeing which data such a chat will search is the point; changing it here is not.
|
||||
/// </remarks>
|
||||
[Parameter]
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the options edited here are the data source defaults of the chat.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Those defaults can be locked by a configuration plugin, and this component reads the locks
|
||||
/// from the chat settings. Wherever the same options belong to something else — to a chat
|
||||
/// template, say — the locks of the chat defaults have nothing to say about them.
|
||||
/// </remarks>
|
||||
[Parameter]
|
||||
public bool ConfiguresChatDefaults { get; set; } = true;
|
||||
|
||||
[Inject]
|
||||
private DataSourceService DataSourceService { get; init; } = null!;
|
||||
|
||||
@@ -334,6 +355,7 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
private bool IsPreselectedDataSourcesDisabledLocked()
|
||||
{
|
||||
return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
|
||||
&& this.ConfiguresChatDefaults
|
||||
&& ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesDisabled, out var meta)
|
||||
&& meta.IsLocked;
|
||||
}
|
||||
@@ -341,6 +363,7 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
private bool IsPreselectedDataSourcesAutomaticSelectionLocked()
|
||||
{
|
||||
return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
|
||||
&& this.ConfiguresChatDefaults
|
||||
&& ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesAutomaticSelection, out var meta)
|
||||
&& meta.IsLocked;
|
||||
}
|
||||
@@ -348,6 +371,7 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
private bool IsPreselectedDataSourcesAutomaticValidationLocked()
|
||||
{
|
||||
return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
|
||||
&& this.ConfiguresChatDefaults
|
||||
&& ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourcesAutomaticValidation, out var meta)
|
||||
&& meta.IsLocked;
|
||||
}
|
||||
@@ -355,6 +379,7 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
private bool IsPreselectedDataSourceIdsLocked()
|
||||
{
|
||||
return this.SelectionMode is DataSourceSelectionMode.CONFIGURATION_MODE
|
||||
&& this.ConfiguresChatDefaults
|
||||
&& ManagedConfiguration.TryGet(x => x.Chat, x => x.PreselectedDataSourceIds, out var meta)
|
||||
&& meta.IsLocked;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user