diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor
index 18d453d6..aeccc50d 100644
--- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor
+++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor
@@ -1,4 +1,4 @@
-@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
+@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
@using AIStudio.Components
@using AIStudio.Settings
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
@@ -6,249 +6,242 @@
@foreach (var component in this.RootComponent!.Children)
{
- @switch (component.Type)
- {
- case AssistantComponentType.TEXT_AREA:
- if (component is AssistantTextArea textArea)
- {
- var lines = textArea.IsSingleLine ? 1 : 6;
-
-
- }
- break;
- case AssistantComponentType.IMAGE:
- if (component is AssistantImage assistantImage)
- {
- var resolvedSource = this.ResolveImageSource(assistantImage);
- if (!string.IsNullOrWhiteSpace(resolvedSource))
- {
- var image = assistantImage;
-
-
- @if (!string.IsNullOrWhiteSpace(image.Caption))
- {
- @image.Caption
- }
-
- }
- }
- break;
- case AssistantComponentType.WEB_CONTENT_READER:
- if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState))
- {
-
-
-
- }
- break;
- case AssistantComponentType.FILE_CONTENT_READER:
- if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
- {
-
-
-
- }
- break;
-
- case AssistantComponentType.DROPDOWN:
- if (component is AssistantDropdown assistantDropdown)
- {
-
- }
- break;
- case AssistantComponentType.BUTTON:
- if (component is AssistantButton assistantButton)
- {
- var button = assistantButton;
-
-
- @button.Text
-
- }
- break;
- case AssistantComponentType.BUTTON_GROUP:
- if (component is AssistantButtonGroup assistantButtonGroup)
- {
- var buttonGroup = assistantButtonGroup;
-
- @foreach (var child in buttonGroup.Children)
- {
- if (child is AssistantButton childButton)
- {
-
- @childButton.Text
-
- }
- }
-
- }
- break;
- case AssistantComponentType.PROVIDER_SELECTION:
- if (component is AssistantProviderSelection providerSelection)
- {
-
- }
- break;
- case AssistantComponentType.PROFILE_SELECTION:
- if (component is AssistantProfileSelection profileSelection)
- {
- var selection = profileSelection;
-
- }
- break;
- case AssistantComponentType.SWITCH:
- if (component is AssistantSwitch switchComponent)
- {
- var assistantSwitch = switchComponent;
- var currentValue = this.switchFields[assistantSwitch.Name];
-
-
- @(currentValue ? assistantSwitch.LabelOn : assistantSwitch.LabelOff)
-
-
- }
- break;
- case AssistantComponentType.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 AssistantComponentType.TEXT:
- if (component is AssistantText assistantText)
- {
- var text = assistantText;
- @text.Content
- }
- break;
- case AssistantComponentType.LIST:
- if (component is AssistantList assistantList)
- {
- var list = assistantList;
-
- @foreach (var item in list.Items)
- {
- @if (item.Type == "LINK")
- {
- @item.Text
- }
- else
- {
- @item.Text
- }
- }
-
- }
- break;
- case AssistantComponentType.COLOR_PICKER:
- if (component is AssistantColorPicker assistantColorPicker)
- {
- var colorPicker = assistantColorPicker;
- var variant = colorPicker.GetPickerVariant();
- var elevation = variant == PickerVariant.Static ? 6 : 0;
- var rounded = variant == PickerVariant.Static;
-
-
-
-
- }
- break;
- }
+ @this.RenderComponent(component)
+}
+
+@code {
+ private RenderFragment RenderChildren(IEnumerable children) => @
+ @foreach (var child in children)
+ {
+ @this.RenderComponent(child)
+ }
+ ;
+
+ private RenderFragment RenderComponent(IAssistantComponent component) => @
+ @switch (component.Type)
+ {
+ case AssistantComponentType.TEXT_AREA:
+ if (component is AssistantTextArea textArea)
+ {
+ var lines = textArea.IsSingleLine ? 1 : 6;
+
+
+ }
+ break;
+ case AssistantComponentType.IMAGE:
+ if (component is AssistantImage assistantImage)
+ {
+ var resolvedSource = this.ResolveImageSource(assistantImage);
+ if (!string.IsNullOrWhiteSpace(resolvedSource))
+ {
+ var image = assistantImage;
+
+
+ @if (!string.IsNullOrWhiteSpace(image.Caption))
+ {
+ @image.Caption
+ }
+
+ }
+ }
+ break;
+ case AssistantComponentType.WEB_CONTENT_READER:
+ if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState))
+ {
+
+
+
+ }
+ break;
+ case AssistantComponentType.FILE_CONTENT_READER:
+ if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
+ {
+
+
+
+ }
+ break;
+ case AssistantComponentType.DROPDOWN:
+ if (component is AssistantDropdown assistantDropdown)
+ {
+
+ }
+ break;
+ case AssistantComponentType.BUTTON:
+ if (component is AssistantButton assistantButton)
+ {
+ var button = assistantButton;
+
+
+ @button.Text
+
+
+ }
+ break;
+ case AssistantComponentType.BUTTON_GROUP:
+ if (component is AssistantButtonGroup assistantButtonGroup)
+ {
+ var buttonGroup = assistantButtonGroup;
+
+ @this.RenderChildren(buttonGroup.Children)
+
+ }
+ break;
+ case AssistantComponentType.PROVIDER_SELECTION:
+ if (component is AssistantProviderSelection providerSelection)
+ {
+
+ }
+ break;
+ case AssistantComponentType.PROFILE_SELECTION:
+ if (component is AssistantProfileSelection profileSelection)
+ {
+ var selection = profileSelection;
+
+ }
+ break;
+ case AssistantComponentType.SWITCH:
+ if (component is AssistantSwitch switchComponent)
+ {
+ var assistantSwitch = switchComponent;
+ var currentValue = this.switchFields[assistantSwitch.Name];
+
+
+ @(currentValue ? assistantSwitch.LabelOn : assistantSwitch.LabelOff)
+
+
+ }
+ break;
+ case AssistantComponentType.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 AssistantComponentType.TEXT:
+ if (component is AssistantText assistantText)
+ {
+ var text = assistantText;
+ @text.Content
+ }
+ break;
+ case AssistantComponentType.LIST:
+ if (component is AssistantList assistantList)
+ {
+ var list = assistantList;
+
+ @foreach (var item in list.Items)
+ {
+ @if (item.Type == "LINK")
+ {
+ @item.Text
+ }
+ else
+ {
+ @item.Text
+ }
+ }
+
+ }
+ break;
+ case AssistantComponentType.COLOR_PICKER:
+ if (component is AssistantColorPicker assistantColorPicker)
+ {
+ var colorPicker = assistantColorPicker;
+ var variant = colorPicker.GetPickerVariant();
+ var elevation = variant == PickerVariant.Static ? 6 : 0;
+ var rounded = variant == PickerVariant.Static;
+
+
+
+
+ }
+ break;
+ }
+ ;
}
diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs
index 6ffee912..f2fac9c0 100644
--- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs
+++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs
@@ -571,5 +571,4 @@ public partial class AssistantDynamic : AssistantBaseCore
var time = this.AddUserRequest(await this.CollectUserPromptAsync());
await this.AddAIResponseAsync(time);
}
-
}