Improved the assistants page with categories for assistant plugins (#1211)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-20 11:47:59 +01:00
1 parent ef059ffd15
commit 1db0f85898
74 files changed
+3392 -380

No files matched your search

@@ -30,7 +30,10 @@ public partial class PluginInfoDialog : MSGComponentBase
private string AuthorsText => this.Plugin.Authors.Length > 0 ? string.Join(", ", this.Plugin.Authors) : this.T("No authors specified");
private string CategoriesText => this.Plugin.Categories.Length > 0 ? string.Join(", ", this.Plugin.Categories.Select(category => category.Name)) : this.T("No categories specified");
/// <summary>
/// The categories of the plugin, with the names it gives its custom categories in place of CUSTOM.
/// </summary>
private string CategoriesText => this.Plugin.Categories.Length > 0 ? string.Join(", ", this.Plugin.Categories.SelectMany(category => category is PluginCategory.CUSTOM ? this.Plugin.CustomCategories : [category.Name])) : this.T("No categories specified");
private string TargetGroupsText => this.Plugin.TargetGroups.Length > 0 ? string.Join(", ", this.Plugin.TargetGroups.Select(targetGroup => targetGroup.Name)) : this.T("No target groups specified");
@@ -0,0 +1,37 @@
@using AIStudio.Settings
@inherits SettingsDialogBase
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h6" Class="d-flex align-center">
<MudIcon Icon="@AppIcons.SETTINGS" Class="mr-2" />
@T("Assistant Settings")
</MudText>
</TitleContent>
<DialogContent>
<ConfigurationSelect OptionDescription="@TA("What should happen to assistants of categories you collapsed?")" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AssistantsPage.CollapsedCategoryAssistants)" Data="@ConfigurationSelectDataFactory.GetAssistantOfferBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AssistantsPage.CollapsedCategoryAssistants = selectedValue)" OptionHelp="@this.CollapsedCategoriesHelp" IsLocked="() => ManagedConfiguration.TryGet(x => x.AssistantsPage, x => x.CollapsedCategoryAssistants, out var meta) && meta.IsLocked"/>
<ConfigurationSelect OptionDescription="@TA("What should happen to assistants of categories you hid?")" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AssistantsPage.HiddenCategoryAssistants)" Data="@ConfigurationSelectDataFactory.GetAssistantOfferBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AssistantsPage.HiddenCategoryAssistants = selectedValue)" OptionHelp="@this.HiddenCategoriesHelp" IsLocked="() => ManagedConfiguration.TryGet(x => x.AssistantsPage, x => x.HiddenCategoryAssistants, out var meta) && meta.IsLocked"/>
<MudText Typo="Typo.h6" Class="mt-6 mb-2">
@T("Categories")
</MudText>
@if (this.Categories.Count == 0)
{
<MudText Typo="Typo.body1">
@T("There are no categories to show or hide right now.")
</MudText>
}
else
{
@foreach (var category in this.Categories)
{
<ConfigurationOption @key="@category" OptionDescription="@category.Name" LabelOn="@T("The category is shown")" LabelOff="@T("The category is hidden")" State="@(() => !this.SettingsManager.ConfigurationData.AssistantsPage.IsCategoryHidden(category))" StateUpdate="@(isShown => this.SettingsManager.ConfigurationData.AssistantsPage.SetCategoryHidden(category, !isShown))"/>
}
}
</DialogContent>
<DialogActions>
<MudButton OnClick="@this.Close" Variant="Variant.Filled">
@T("Close")
</MudButton>
</DialogActions>
</MudDialog>
@@ -0,0 +1,26 @@
using AIStudio.Tools.PluginSystem;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Dialogs.Settings;
/// <summary>
/// The settings of the assistants page: what happens to the assistants of collapsed and hidden categories,
/// and which categories the page shows.
/// </summary>
public partial class SettingsDialogAssistantsPage : SettingsDialogBase
{
/// <summary>
/// The categories the dialog offers to show or hide, in the order of the page.
/// </summary>
/// <remarks>
/// The caller selects them with AssistantPageSections.SelectForSettings. The list stays the same while
/// the dialog is open, so that a category the user hides here keeps its switch.
/// </remarks>
[Parameter]
public IReadOnlyList<AssistantCategoryKey> Categories { get; set; } = [];
private string CollapsedCategoriesHelp => TA("""Collapsing a category keeps the assistants page tidy. Choose whether AI Studio keeps offering its assistants elsewhere, e.g., in the "Send to ..." menu.""");
private string HiddenCategoriesHelp => TA("""Hiding a category says that you do not need its assistants. Choose whether AI Studio still offers them elsewhere, e.g., in the "Send to ..." menu.""");
}