AI-Studio/app/MindWork AI Studio/Settings/DataModel/DataApp.cs
Claude 509d57f69a
Add config plugin support to hide individual assistants
This change enables enterprise IT departments to hide specific assistants
via configuration plugins, providing better control over which features
are available to end users.

Changes:
- Created ConfigurableAssistant enum listing all hideable assistants
- Added HiddenAssistants property to DataApp settings (HashSet<ConfigurableAssistant>)
- Added IsAssistantVisible() method in Assistants.razor.cs to check visibility
- Updated Assistants.razor to conditionally render assistants based on configuration
- Extended plugin.lua template with HiddenAssistants configuration example

Example usage in configuration plugin:
CONFIG["SETTINGS"]["DataApp.HiddenAssistants"] = { "GRAMMAR_SPELLING_ASSISTANT", "SYNONYMS_ASSISTANT" }

The setting integrates with the existing ManagedConfiguration system and
is locked when managed by a config plugin, preventing user override.
2026-01-11 22:18:26 +00:00

94 lines
3.6 KiB
C#

using System.Linq.Expressions;
namespace AIStudio.Settings.DataModel;
public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = null)
{
/// <summary>
/// The default constructor for the JSON deserializer.
/// </summary>
public DataApp() : this(null)
{
}
/// <summary>
/// The language behavior.
/// </summary>
public LangBehavior LanguageBehavior { get; set; } = LangBehavior.AUTO;
/// <summary>
/// The language plugin ID to use.
/// </summary>
public Guid LanguagePluginId { get; set; } = Guid.Empty;
/// <summary>
/// The preferred theme to use.
/// </summary>
public Themes PreferredTheme { get; set; } = Themes.SYSTEM;
/// <summary>
/// Should we save energy? When true, we will update content streamed
/// from the server, i.e., AI, less frequently.
/// </summary>
public bool IsSavingEnergy { get; set; } = ManagedConfiguration.Register(configSelection, n => n.IsSavingEnergy, false);
/// <summary>
/// Should we enable spellchecking for all input fields?
/// </summary>
public bool EnableSpellchecking { get; set; }
/// <summary>
/// If and when we should look for updates.
/// </summary>
public UpdateInterval UpdateInterval { get; set; } = ManagedConfiguration.Register(configSelection, n => n.UpdateInterval, UpdateInterval.HOURLY);
/// <summary>
/// How updates should be installed.
/// </summary>
public UpdateInstallation UpdateInstallation { get; set; } = ManagedConfiguration.Register(configSelection, n => n.UpdateInstallation, UpdateInstallation.MANUAL);
/// <summary>
/// The navigation behavior.
/// </summary>
public NavBehavior NavigationBehavior { get; set; } = NavBehavior.NEVER_EXPAND_USE_TOOLTIPS;
/// <summary>
/// The visibility setting for previews features.
/// </summary>
public PreviewVisibility PreviewVisibility { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreviewVisibility, PreviewVisibility.NONE);
/// <summary>
/// The enabled preview features.
/// </summary>
public HashSet<PreviewFeatures> EnabledPreviewFeatures { get; set; } = ManagedConfiguration.Register(configSelection, n => n.EnabledPreviewFeatures, []);
/// <summary>
/// Should we preselect a provider for the entire app?
/// </summary>
public string PreselectedProvider { get; set; } = string.Empty;
/// <summary>
/// Should we preselect a profile for the entire app?
/// </summary>
public string PreselectedProfile { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProfile, string.Empty);
/// <summary>
/// Should we preselect a chat template for the entire app?
/// </summary>
public string PreselectedChatTemplate { get; set; } = string.Empty;
/// <summary>
/// Which transcription provider should be used?
/// </summary>
public string UseTranscriptionProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.UseTranscriptionProvider, string.Empty);
/// <summary>
/// Should the user be allowed to add providers?
/// </summary>
public bool AllowUserToAddProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.AllowUserToAddProvider, true);
/// <summary>
/// List of assistants that should be hidden from the UI.
/// </summary>
public HashSet<ConfigurableAssistant> HiddenAssistants { get; set; } = ManagedConfiguration.Register(configSelection, n => n.HiddenAssistants, []);
}