From f7e1279c4f7f952b34db3b37332ece3023c67d78 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 31 Jan 2026 21:47:32 +0100 Subject: [PATCH] Added option to hide policy definition --- .../DocumentAnalysisAssistant.razor | 177 ++++++++++-------- .../Plugins/configuration/plugin.lua | 9 +- .../DataModel/DataDocumentAnalysisPolicy.cs | 16 +- 3 files changed, 125 insertions(+), 77 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor index fbf8c992..6f8cd8d6 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor @@ -51,86 +51,115 @@ else - - - @if (!this.policyDefinitionExpanded) - { - - @T("Expand this section to view and edit the policy definition.") - - } - else - { - - @T("Common settings") - - - - - - - - - - - - - - - - @T("Analysis and output rules") - - - - @T("Use the analysis and output rules to define how the AI evaluates your documents and formats the results.") - - - - @T("The analysis rules specify what the AI should pay particular attention to while reviewing the documents you provide, and which aspects it should highlight or save. For example, if you want to extract the potential of green hydrogen for agriculture from a variety of general publications, you can explicitly define this in the analysis rules.") - - - - - - - - @T("After the AI has processed all documents, it needs your instructions on how the result should be formatted. Would you like a structured list with keywords or a continuous text? Should the output include emojis or be written in formal business language? You can specify all these preferences in the output rules. There, you can also predefine a desired structure—for example, by using Markdown formatting to define headings, paragraphs, or bullet points.") - - - - - - - - @T("Preparation for enterprise distribution") - - - - - @T("Export policy as configuration section") - - - } - - - - - - + + +@if (this.selectedPolicy?.HidePolicyDefinition ?? false) +{ + @* When HidePolicyDefinition is true, show only the document selection section without expansion panels *@ +
+ + @T("Document selection - Policy"): @this.selectedPolicy?.PolicyName + + + @T("Policy Description") - + @this.selectedPolicy?.PolicyDescription - - + + @T("Documents for the analysis") - + - - - +
+} +else +{ + @* Standard view with expansion panels *@ + + + @if (!this.policyDefinitionExpanded) + { + + @T("Expand this section to view and edit the policy definition.") + + } + else + { + + @T("Common settings") + + + + + + + + + + + + + + + + @T("Analysis and output rules") + + + + @T("Use the analysis and output rules to define how the AI evaluates your documents and formats the results.") + + + + @T("The analysis rules specify what the AI should pay particular attention to while reviewing the documents you provide, and which aspects it should highlight or save. For example, if you want to extract the potential of green hydrogen for agriculture from a variety of general publications, you can explicitly define this in the analysis rules.") + + + + + + + + @T("After the AI has processed all documents, it needs your instructions on how the result should be formatted. Would you like a structured list with keywords or a continuous text? Should the output include emojis or be written in formal business language? You can specify all these preferences in the output rules. There, you can also predefine a desired structure—for example, by using Markdown formatting to define headings, paragraphs, or bullet points.") + + + + + + + + @T("Preparation for enterprise distribution") + + + + + @T("Export policy as configuration section") + + + } + + + + + + + @T("Policy Description") + + + + @this.selectedPolicy?.PolicyDescription + + + + @T("Documents for the analysis") + + + + + + +} - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/configuration/plugin.lua b/app/MindWork AI Studio/Plugins/configuration/plugin.lua index 389022b5..73061b73 100644 --- a/app/MindWork AI Studio/Plugins/configuration/plugin.lua +++ b/app/MindWork AI Studio/Plugins/configuration/plugin.lua @@ -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: diff --git a/app/MindWork AI Studio/Settings/DataModel/DataDocumentAnalysisPolicy.cs b/app/MindWork AI Studio/Settings/DataModel/DataDocumentAnalysisPolicy.cs index bbfee658..f2cbcfea 100644 --- a/app/MindWork AI Studio/Settings/DataModel/DataDocumentAnalysisPolicy.cs +++ b/app/MindWork AI Studio/Settings/DataModel/DataDocumentAnalysisPolicy.cs @@ -67,7 +67,14 @@ public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject /// Preselect a profile? /// public string PreselectedProfile { get; set; } = string.Empty; - + + /// + /// 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. + /// + public bool HidePolicyDefinition { get; set; } + public static bool TryProcessConfiguration(int idx, LuaTable table, Guid configPluginId, out ConfigurationBaseObject policy) { policy = new DataDocumentAnalysisPolicy(); @@ -118,7 +125,11 @@ public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject var preselectedProfile = string.Empty; if (table.TryGetValue("PreselectedProfile", out var profileValue) && profileValue.TryRead(out var profileId)) preselectedProfile = profileId; - + + var hidePolicyDefinition = false; + if (table.TryGetValue("HidePolicyDefinition", out var hideValue) && hideValue.TryRead(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,