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

@@ -39,6 +39,12 @@ public static class ConfigurationSelectDataFactory
}
}
public static IEnumerable<ConfigurationSelectData<AssistantOfferBehavior>> GetAssistantOfferBehaviorData()
{
yield return new(TB("""Keep offering me the assistants, e.g., in the "Send to ..." menu"""), AssistantOfferBehavior.KEEP_OFFERING);
yield return new(TB("""Treat the assistants as if they did not exist, e.g., not in the "Send to ..." menu"""), AssistantOfferBehavior.TREAT_AS_ABSENT);
}
public static IEnumerable<ConfigurationSelectData<LoadingChatProviderBehavior>> GetLoadingChatProviderBehavior()
{
yield return new(TB("When possible, use the LLM provider which was used for each chat in the first place"), LoadingChatProviderBehavior.USE_CHAT_PROVIDER_IF_AVAILABLE);
@@ -0,0 +1,17 @@
namespace AIStudio.Settings.DataModel;
/// <summary>
/// What happens to the assistants of a category the user collapsed or hid on the assistants page.
/// </summary>
public enum AssistantOfferBehavior
{
/// <summary>
/// AI Studio keeps offering the assistants outside of the assistants page, e.g., in the "Send to ..." menu.
/// </summary>
KEEP_OFFERING,
/// <summary>
/// AI Studio treats the assistants as if they did not exist, e.g., the "Send to ..." menu leaves them out.
/// </summary>
TREAT_AS_ABSENT,
}
@@ -165,6 +165,11 @@ public sealed class Data
public DataChat Chat { get; set; } = new(x => x.Chat);
/// <summary>
/// Gets the settings of the assistants page: collapsed and hidden categories.
/// </summary>
public DataAssistantsPage AssistantsPage { get; set; } = new(x => x.AssistantsPage);
public DataWorkspace Workspace { get; set; } = new();
public DataIconFinder IconFinder { get; set; } = new();
@@ -410,4 +410,25 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
/// List of assistants that should be hidden from the UI.
/// </summary>
public HashSet<ConfigurableAssistant> HiddenAssistants { get; set; } = ManagedConfiguration.Register(configSelection, n => n.HiddenAssistants, []);
/// <summary>
/// The categories of assistants your organization disabled.
/// </summary>
/// <remarks>
/// Only a configuration plugin fills this. Unlike HiddenAssistants, it covers assistant plugins as
/// well, e.g., entertainment plugins on the devices of an organization. Ask AssistantCategoryRules
/// instead of reading it: CORE counts as COMMON there, CUSTOM stands for every custom category, a
/// plugin with several categories stays available while one of them is free, and a plugin your
/// organization deployed itself is never disabled by its categories.
/// </remarks>
public HashSet<PluginCategory> DisabledAssistantCategories { get; set; } = ManagedConfiguration.Register(configSelection, n => n.DisabledAssistantCategories, []);
/// <summary>
/// The custom categories of assistant plugins your organization disabled, by their names.
/// </summary>
/// <remarks>
/// Only a configuration plugin fills this. The names are compared without regard to case, like the
/// headings of the assistants page. See DisabledAssistantCategories.
/// </remarks>
public HashSet<string> DisabledCustomAssistantCategories { get; set; } = ManagedConfiguration.Register(configSelection, n => n.DisabledCustomAssistantCategories, []);
}
@@ -0,0 +1,65 @@
using System.Linq.Expressions;
using AIStudio.Tools.PluginSystem;
namespace AIStudio.Settings.DataModel;
/// <summary>
/// The settings of the assistants page: the categories the user collapsed or hid, and what that means for
/// their assistants.
/// </summary>
/// <remarks>
/// Collapsing and hiding are choices of the user alone and never managed: both only take something out of
/// sight. Your organization disables categories elsewhere, see DataApp.DisabledAssistantCategories. It may,
/// however, preset or lock the two options which decide whether AI Studio keeps offering the assistants of
/// collapsed and hidden categories, e.g., in the "Send to ..." menu.<br/><br/>
/// Ask AssistantCategoryRules instead of reading the categories: CORE counts as COMMON there, and custom
/// categories are compared without regard to case.
/// </remarks>
/// <param name="configSelection">The managed-configuration selector.</param>
public sealed class DataAssistantsPage(Expression<Func<Data, DataAssistantsPage>>? configSelection = null)
{
/// <summary>
/// The default constructor for the JSON deserializer.
/// </summary>
public DataAssistantsPage() : this(null)
{
}
/// <summary>
/// The categories of AI Studio the user collapsed on the assistants page.
/// </summary>
public HashSet<PluginCategory> CollapsedCategories { get; set; } = [];
/// <summary>
/// The custom categories the user collapsed on the assistants page, by their names.
/// </summary>
public HashSet<string> CollapsedCustomCategories { get; set; } = [];
/// <summary>
/// The categories of AI Studio the user hid on the assistants page.
/// </summary>
public HashSet<PluginCategory> HiddenCategories { get; set; } = [];
/// <summary>
/// The custom categories the user hid on the assistants page, by their names.
/// </summary>
public HashSet<string> HiddenCustomCategories { get; set; } = [];
/// <summary>
/// What happens to the assistants of collapsed categories outside of the assistants page.
/// </summary>
/// <remarks>
/// Collapsing a category is about a tidy page, so AI Studio keeps offering its assistants by default.
/// </remarks>
public AssistantOfferBehavior CollapsedCategoryAssistants { get; set; } = ManagedConfiguration.Register(configSelection, n => n.CollapsedCategoryAssistants, AssistantOfferBehavior.KEEP_OFFERING);
/// <summary>
/// What happens to the assistants of hidden categories outside of the assistants page.
/// </summary>
/// <remarks>
/// Hiding a category says that its assistants do not matter to the user, so AI Studio treats them as if
/// they did not exist by default.
/// </remarks>
public AssistantOfferBehavior HiddenCategoryAssistants { get; set; } = ManagedConfiguration.Register(configSelection, n => n.HiddenCategoryAssistants, AssistantOfferBehavior.TREAT_AS_ABSENT);
}
@@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
using AIStudio.Provider;
using AIStudio.Settings.DataModel;
using AIStudio.Settings.DataModel.PreviousModels;
using AIStudio.Tools.PluginSystem;
using EMailWritingStyles = AIStudio.Assistants.EMail.WritingStyles;
using ERIContentType = AIStudio.Tools.ERIClient.DataModel.ContentType;
@@ -32,6 +33,7 @@ namespace AIStudio.Settings;
[JsonSerializable(typeof(ISet<PreviewFeatures>))]
[JsonSerializable(typeof(ISet<LLMProviders>))]
[JsonSerializable(typeof(ISet<ConfigurableAssistant>))]
[JsonSerializable(typeof(ISet<PluginCategory>))]
[JsonSerializable(typeof(IList<string>))]
[JsonSerializable(typeof(IList<DataAssistantPluginEnterpriseApproval>))]
[JsonSerializable(typeof(IDictionary<string, string>))]