mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 07:01:37 +00:00
Added option to hide policy definition
This commit is contained in:
parent
f9f73643b2
commit
f7e1279c4f
@ -51,7 +51,35 @@ else
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
|
||||
<MudExpansionPanels Class="mb-3 mt-6" MultiExpansion="@false">
|
||||
<MudDivider Style="height: 0.25ch; margin: 1rem 0;" Class="mt-6" />
|
||||
|
||||
@if (this.selectedPolicy?.HidePolicyDefinition ?? false)
|
||||
{
|
||||
@* When HidePolicyDefinition is true, show only the document selection section without expansion panels *@
|
||||
<div class="mb-3 mt-3">
|
||||
<MudText Typo="Typo.h5" Class="mb-3">
|
||||
@T("Document selection - Policy"): @this.selectedPolicy?.PolicyName
|
||||
</MudText>
|
||||
|
||||
<MudText Typo="Typo.h6" Class="mb-1">
|
||||
@T("Policy Description")
|
||||
</MudText>
|
||||
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@this.selectedPolicy?.PolicyDescription
|
||||
</MudJustifiedText>
|
||||
|
||||
<MudText Typo="Typo.h6" Class="mb-1 mt-6">
|
||||
@T("Documents for the analysis")
|
||||
</MudText>
|
||||
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.providerSettings"/>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@* Standard view with expansion panels *@
|
||||
<MudExpansionPanels Class="mb-3 mt-3" MultiExpansion="@false">
|
||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Policy" HeaderText="@(T("Policy definition") + $": {this.selectedPolicy?.PolicyName}")" IsExpanded="@this.policyDefinitionExpanded" ExpandedChanged="@this.PolicyDefinitionExpandedChanged">
|
||||
@if (!this.policyDefinitionExpanded)
|
||||
{
|
||||
@ -131,6 +159,7 @@ else
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.providerSettings"/>
|
||||
|
||||
</ExpansionPanel>
|
||||
</MudExpansionPanels>
|
||||
</MudExpansionPanels>
|
||||
}
|
||||
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider" ExplicitMinimumConfidence="@this.GetPolicyMinimumConfidenceLevel()"/>
|
||||
@ -241,7 +241,14 @@ CONFIG["DOCUMENT_ANALYSIS_POLICIES"] = {}
|
||||
-- -- Optional: preselect a provider or profile by ID.
|
||||
-- -- The IDs must exist in CONFIG["LLM_PROVIDERS"] or CONFIG["PROFILES"].
|
||||
-- ["PreselectedProvider"] = "00000000-0000-0000-0000-000000000000",
|
||||
-- ["PreselectedProfile"] = "00000000-0000-0000-0000-000000000000"
|
||||
-- ["PreselectedProfile"] = "00000000-0000-0000-0000-000000000000",
|
||||
--
|
||||
-- -- Optional: hide the policy definition section in the UI.
|
||||
-- -- When set to true, users will only see the document selection interface
|
||||
-- -- and cannot view or modify the policy settings.
|
||||
-- -- This is useful for enterprise configurations where policy details should remain hidden.
|
||||
-- -- Allowed values are: true, false (default: false)
|
||||
-- ["HidePolicyDefinition"] = false
|
||||
-- }
|
||||
|
||||
-- Profiles for this configuration:
|
||||
|
||||
@ -68,6 +68,13 @@ public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject
|
||||
/// </summary>
|
||||
public string PreselectedProfile { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Hide the policy definition section in the UI?
|
||||
/// If true, the policy definition panel will be hidden and only the document selection will be shown.
|
||||
/// This is useful for enterprise configurations where users should not see or modify the policy details.
|
||||
/// </summary>
|
||||
public bool HidePolicyDefinition { get; set; }
|
||||
|
||||
public static bool TryProcessConfiguration(int idx, LuaTable table, Guid configPluginId, out ConfigurationBaseObject policy)
|
||||
{
|
||||
policy = new DataDocumentAnalysisPolicy();
|
||||
@ -119,6 +126,10 @@ public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject
|
||||
if (table.TryGetValue("PreselectedProfile", out var profileValue) && profileValue.TryRead<string>(out var profileId))
|
||||
preselectedProfile = profileId;
|
||||
|
||||
var hidePolicyDefinition = false;
|
||||
if (table.TryGetValue("HidePolicyDefinition", out var hideValue) && hideValue.TryRead<bool>(out var hide))
|
||||
hidePolicyDefinition = hide;
|
||||
|
||||
policy = new DataDocumentAnalysisPolicy
|
||||
{
|
||||
Id = id.ToString(),
|
||||
@ -130,6 +141,7 @@ public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject
|
||||
MinimumProviderConfidence = minimumConfidence,
|
||||
PreselectedProvider = preselectedProvider,
|
||||
PreselectedProfile = preselectedProfile,
|
||||
HidePolicyDefinition = hidePolicyDefinition,
|
||||
IsProtected = true,
|
||||
IsEnterpriseConfiguration = true,
|
||||
EnterpriseConfigurationPluginId = configPluginId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user