From bc50b3728cad64a14f2560f4d117e1ac2e4b704a Mon Sep 17 00:00:00 2001 From: krut_ni Date: Tue, 10 Feb 2026 16:12:59 +0100 Subject: [PATCH] Added new descriptive heading and text components --- .../Assistants/Dynamic/AssistantDynamic.razor | 28 +++++++++++++++++++ .../Plugins/assistants/plugin.lua | 13 +++++++++ .../Assistants/AssistantComponentFactory.cs | 4 +++ .../Assistants/DataModel/AssistantHeading.cs | 27 ++++++++++++++++++ .../Assistants/DataModel/AssistantText.cs | 18 ++++++++++++ .../DataModel/AssistantUiCompontentType.cs | 2 ++ .../DataModel/ComponentPropSpecs.cs | 8 ++++++ 7 files changed, 100 insertions(+) create mode 100644 app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantHeading.cs create mode 100644 app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantText.cs diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor index a5b2feac..a138dc5b 100644 --- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor +++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor @@ -36,5 +36,33 @@ } break; + case AssistantUiCompontentType.HEADING: + if (component is AssistantHeading assistantHeading) + { + var heading = assistantHeading; + @switch (assistantHeading.Level) + { + case 1: + @heading.Text + break; + case 2: + @heading.Text + break; + case 3: + @heading.Text + break; + default: + @heading.Text + break; + } + } + break; + case AssistantUiCompontentType.TEXT: + if (component is AssistantText assistantText) + { + var text = assistantText; + @text.Content + } + break; } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Plugins/assistants/plugin.lua b/app/MindWork AI Studio/Plugins/assistants/plugin.lua index 5330dc2f..ca1b6d53 100644 --- a/app/MindWork AI Studio/Plugins/assistants/plugin.lua +++ b/app/MindWork AI Studio/Plugins/assistants/plugin.lua @@ -106,6 +106,19 @@ ASSISTANT = { ["Label"] = "LLM auswählen" } }, + { + ["Type"] = "HEADING", -- descriptive component for headings + ["Props"] = { + ["Text"] = "This is a Section Heading", -- The heading text + ["Level"] = 2 -- Heading level, 1 - 3 + } + }, + { + ["Type"] = "TEXT", -- descriptive component for normal text + ["Props"] = { + ["Content"] = "This is a paragraph of descriptive text that explains something about the assistant or provides additional information." + } + }, } }, } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/AssistantComponentFactory.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/AssistantComponentFactory.cs index 3efe0e48..32f50c40 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/AssistantComponentFactory.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/AssistantComponentFactory.cs @@ -25,6 +25,10 @@ public class AssistantComponentFactory return new AssistantProviderSelection { Props = props, Children = children }; case AssistantUiCompontentType.SWITCH: return new AssistantSwitch { Props = props, Children = children }; + case AssistantUiCompontentType.HEADING: + return new AssistantHeading { Props = props, Children = children }; + case AssistantUiCompontentType.TEXT: + return new AssistantText { Props = props, Children = children }; default: LOGGER.LogError($"Unknown assistant component type!\n{type} is not a supported assistant component type"); throw new Exception($"Unknown assistant component type: {type}"); diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantHeading.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantHeading.cs new file mode 100644 index 00000000..68f6f450 --- /dev/null +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantHeading.cs @@ -0,0 +1,27 @@ +namespace AIStudio.Tools.PluginSystem.Assistants.DataModel; + +public class AssistantHeading : AssistantComponentBase +{ + public override AssistantUiCompontentType Type => AssistantUiCompontentType.HEADING; + + public Dictionary Props { get; set; } = new(); + + public List Children { get; set; } = new(); + + public string Text + { + get => this.Props.TryGetValue(nameof(this.Text), out var v) + ? v.ToString() ?? string.Empty + : string.Empty; + set => this.Props[nameof(this.Text)] = value; + } + + public int Level + { + get => this.Props.TryGetValue(nameof(this.Level), out var v) + && int.TryParse(v.ToString(), out var i) + ? i + : 2; + set => this.Props[nameof(this.Level)] = value; + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantText.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantText.cs new file mode 100644 index 00000000..01bec268 --- /dev/null +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantText.cs @@ -0,0 +1,18 @@ +namespace AIStudio.Tools.PluginSystem.Assistants.DataModel; + +public class AssistantText : AssistantComponentBase +{ + public override AssistantUiCompontentType Type => AssistantUiCompontentType.TEXT; + + public Dictionary Props { get; set; } = new(); + + public List Children { get; set; } = new(); + + public string Content + { + get => this.Props.TryGetValue(nameof(this.Content), out var v) + ? v.ToString() ?? string.Empty + : string.Empty; + set => this.Props[nameof(this.Content)] = value; + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantUiCompontentType.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantUiCompontentType.cs index 74254205..e5ef6268 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantUiCompontentType.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantUiCompontentType.cs @@ -8,4 +8,6 @@ public enum AssistantUiCompontentType DROPDOWN, PROVIDER_SELECTION, SWITCH, + HEADING, + TEXT, } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs index fe5b0328..0cbc4424 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs @@ -29,5 +29,13 @@ public static class ComponentPropSpecs required: ["Name", "Label", "LabelOn", "LabelOff", "Value"], optional: ["UserPrompt"] ), + [AssistantUiCompontentType.HEADING] = new( + required: ["Text", "Level"], + optional: [] + ), + [AssistantUiCompontentType.TEXT] = new( + required: ["Content"], + optional: [] + ), }; } \ No newline at end of file