2025-09-30 19:53:56 +00:00
|
|
|
@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
|
2026-02-23 14:01:00 +00:00
|
|
|
@using AIStudio.Components
|
|
|
|
|
@using AIStudio.Settings
|
2025-09-30 19:53:56 +00:00
|
|
|
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
|
|
|
|
|
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogDynamic>
|
|
|
|
|
|
|
|
|
|
@foreach (var component in this.RootComponent!.Children)
|
|
|
|
|
{
|
|
|
|
|
@switch (component.Type)
|
|
|
|
|
{
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.TEXT_AREA:
|
2025-09-30 19:53:56 +00:00
|
|
|
if (component is AssistantTextArea textArea)
|
|
|
|
|
{
|
2025-11-11 13:51:34 +00:00
|
|
|
var lines = textArea.IsSingleLine ? 1 : 6;
|
|
|
|
|
<MudTextField T="string" @bind-Text="@this.inputFields[textArea.Name]" Label="@textArea.Label" ReadOnly="@textArea.ReadOnly" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Variant="Variant.Outlined" Lines="@lines" AutoGrow="@true" MaxLines="12" Class="mb-3"/>
|
2025-09-30 19:53:56 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.IMAGE:
|
2026-02-24 10:31:16 +00:00
|
|
|
if (component is AssistantImage assistantImage)
|
|
|
|
|
{
|
|
|
|
|
var resolvedSource = this.ResolveImageSource(assistantImage);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(resolvedSource))
|
|
|
|
|
{
|
|
|
|
|
var image = assistantImage;
|
|
|
|
|
<div Class="mb-4">
|
|
|
|
|
<MudImage Fluid="true" Src="@resolvedSource" Alt="@image.Alt" Class="rounded-lg mb-2" Elevation="20"/>
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(image.Caption))
|
|
|
|
|
{
|
|
|
|
|
<MudText Typo="Typo.caption" Align="Align.Center">@image.Caption</MudText>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.WEB_CONTENT_READER:
|
2026-02-23 15:13:28 +00:00
|
|
|
if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState))
|
|
|
|
|
{
|
|
|
|
|
<ReadWebContent @bind-Content="@webState.Content"
|
|
|
|
|
ProviderSettings="@this.providerSettings"
|
|
|
|
|
@bind-AgentIsRunning="@webState.AgentIsRunning"
|
|
|
|
|
@bind-Preselect="@webState.Preselect"
|
|
|
|
|
@bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent" />
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.FILE_CONTENT_READER:
|
2026-02-23 15:33:24 +00:00
|
|
|
if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
|
|
|
|
|
{
|
|
|
|
|
<ReadFileContent @bind-FileContent="@fileState.Content" />
|
|
|
|
|
}
|
|
|
|
|
break;
|
2025-11-10 16:01:49 +00:00
|
|
|
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.DROPDOWN:
|
2025-11-10 16:01:49 +00:00
|
|
|
if (component is AssistantDropdown assistantDropdown)
|
|
|
|
|
{
|
|
|
|
|
<DynamicAssistantDropdown Items="@assistantDropdown.Items"
|
2025-11-11 14:57:15 +00:00
|
|
|
@bind-Value="@this.dropdownFields[assistantDropdown.Name]"
|
2025-11-10 16:01:49 +00:00
|
|
|
Default="@assistantDropdown.Default"
|
|
|
|
|
Label="@assistantDropdown.Label"
|
|
|
|
|
Icon="@Icons.Material.Filled.Translate"/>
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.PROVIDER_SELECTION:
|
2025-09-30 19:53:56 +00:00
|
|
|
if (component is AssistantProviderSelection providerSelection)
|
|
|
|
|
{
|
|
|
|
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.PROFILE_SELECTION:
|
2026-02-23 14:01:00 +00:00
|
|
|
if (component is AssistantProfileSelection profileSelection)
|
|
|
|
|
{
|
|
|
|
|
var selection = profileSelection;
|
|
|
|
|
<ProfileFormSelection Validation="@((Profile profile) => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile"/>
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.SWITCH:
|
2025-11-11 18:06:44 +00:00
|
|
|
if (component is AssistantSwitch assistantSwitch)
|
|
|
|
|
{
|
|
|
|
|
<MudTextSwitch Label="@assistantSwitch.Label" @bind-Value="@this.switchFields[assistantSwitch.Name]" LabelOn="@assistantSwitch.LabelOn" LabelOff="@assistantSwitch.LabelOff" />
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.HEADING:
|
2026-02-10 15:12:59 +00:00
|
|
|
if (component is AssistantHeading assistantHeading)
|
|
|
|
|
{
|
|
|
|
|
var heading = assistantHeading;
|
|
|
|
|
@switch (assistantHeading.Level)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
<MudText Typo="Typo.h4">@heading.Text</MudText>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
<MudText Typo="Typo.h5">@heading.Text</MudText>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
<MudText Typo="Typo.h6">@heading.Text</MudText>
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
<MudText Typo="Typo.h4">@heading.Text</MudText>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.TEXT:
|
2026-02-10 15:12:59 +00:00
|
|
|
if (component is AssistantText assistantText)
|
|
|
|
|
{
|
|
|
|
|
var text = assistantText;
|
|
|
|
|
<MudText Typo="Typo.body1" Class="mb-3">@text.Content</MudText>
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-02-24 10:39:17 +00:00
|
|
|
case AssistantComponentType.LIST:
|
2026-02-10 16:06:45 +00:00
|
|
|
if (component is AssistantList assistantList)
|
|
|
|
|
{
|
|
|
|
|
var list = assistantList;
|
|
|
|
|
<MudList T="string" Class="mb-6">
|
|
|
|
|
@foreach (var item in list.Items)
|
|
|
|
|
{
|
|
|
|
|
@if (item.Type == "LINK")
|
|
|
|
|
{
|
|
|
|
|
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="@item.Href">@item.Text</MudListItem>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MudListItem T="string">@item.Text</MudListItem>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</MudList>
|
|
|
|
|
}
|
|
|
|
|
break;
|
2025-09-30 19:53:56 +00:00
|
|
|
}
|
2026-02-23 14:01:00 +00:00
|
|
|
}
|