Adding Providers can now be disabled in the plugin

This commit is contained in:
Peer Schütt 2025-07-11 16:05:03 +02:00
parent 6116c03f7c
commit 9c32595d72
4 changed files with 17 additions and 3 deletions

View File

@ -75,7 +75,7 @@
</MudText> </MudText>
} }
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddLLMProvider"> <MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddLLMProvider" Disabled="@this.SettingsManager.ConfigurationData.App.DontAllowUserToAddProvider">
@T("Add Provider") @T("Add Provider")
</MudButton> </MudButton>

View File

@ -65,3 +65,7 @@ CONFIG["SETTINGS"] = {}
-- Configure the update behavior: -- Configure the update behavior:
-- Allowed values are: NO_CHECK, ONCE_STARTUP, HOURLY, DAILY, WEEKLY -- Allowed values are: NO_CHECK, ONCE_STARTUP, HOURLY, DAILY, WEEKLY
-- CONFIG["SETTINGS"]["DataApp.UpdateBehavior"] = "NO_CHECK" -- CONFIG["SETTINGS"]["DataApp.UpdateBehavior"] = "NO_CHECK"
-- Configure the user permission to add providers:
-- Allowed values are: true, false
-- CONFIG["SETTINGS"]["DataApp.DontAllowUserToAddProvider"] = false

View File

@ -58,9 +58,13 @@ public sealed class DataApp
/// </summary> /// </summary>
public string PreselectedProfile { get; set; } = string.Empty; public string PreselectedProfile { get; set; } = string.Empty;
/// <summary> /// <summary>
/// Should we preselect a chat template for the entire app? /// Should we preselect a chat template for the entire app?
/// </summary> /// </summary>
public string PreselectedChatTemplate { get; set; } = string.Empty; public string PreselectedChatTemplate { get; set; } = string.Empty;
/// <summary>
/// Should the user be allowed to add providers?
/// </summary>
public bool DontAllowUserToAddProvider { get; set; }
} }

View File

@ -54,6 +54,12 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior; SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior;
} }
if (settingsTable.TryGetValue(SettingsManager.ToSettingName<DataApp>(x => x.DontAllowUserToAddProvider), out var dontAllowUserToAddProviderValue) && dontAllowUserToAddProviderValue.TryRead<bool>(out var dontAllowUserToAddProviderEntry))
{
SETTINGS_LOCKER.Register<DataApp>(x => x.DontAllowUserToAddProvider, this.Id);
SETTINGS_MANAGER.ConfigurationData.App.DontAllowUserToAddProvider = dontAllowUserToAddProviderEntry;
}
// //
// Configured providers // Configured providers
// //