renamed AssistantComponentType.cs because of a typo

This commit is contained in:
Nils Kruthoff 2026-02-24 11:39:17 +01:00
parent 49746a2c07
commit b4702b17d4
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
21 changed files with 72 additions and 72 deletions

View File

@ -8,14 +8,14 @@
{ {
@switch (component.Type) @switch (component.Type)
{ {
case AssistantUiCompontentType.TEXT_AREA: case AssistantComponentType.TEXT_AREA:
if (component is AssistantTextArea textArea) if (component is AssistantTextArea textArea)
{ {
var lines = textArea.IsSingleLine ? 1 : 6; 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"/> <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"/>
} }
break; break;
case AssistantUiCompontentType.IMAGE: case AssistantComponentType.IMAGE:
if (component is AssistantImage assistantImage) if (component is AssistantImage assistantImage)
{ {
var resolvedSource = this.ResolveImageSource(assistantImage); var resolvedSource = this.ResolveImageSource(assistantImage);
@ -32,7 +32,7 @@
} }
} }
break; break;
case AssistantUiCompontentType.WEB_CONTENT_READER: case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState)) if (component is AssistantWebContentReader webContent && this.webContentFields.TryGetValue(webContent.Name, out var webState))
{ {
<ReadWebContent @bind-Content="@webState.Content" <ReadWebContent @bind-Content="@webState.Content"
@ -42,14 +42,14 @@
@bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent" /> @bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent" />
} }
break; break;
case AssistantUiCompontentType.FILE_CONTENT_READER: case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState)) if (component is AssistantFileContentReader fileContent && this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
{ {
<ReadFileContent @bind-FileContent="@fileState.Content" /> <ReadFileContent @bind-FileContent="@fileState.Content" />
} }
break; break;
case AssistantUiCompontentType.DROPDOWN: case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown assistantDropdown) if (component is AssistantDropdown assistantDropdown)
{ {
<DynamicAssistantDropdown Items="@assistantDropdown.Items" <DynamicAssistantDropdown Items="@assistantDropdown.Items"
@ -59,26 +59,26 @@
Icon="@Icons.Material.Filled.Translate"/> Icon="@Icons.Material.Filled.Translate"/>
} }
break; break;
case AssistantUiCompontentType.PROVIDER_SELECTION: case AssistantComponentType.PROVIDER_SELECTION:
if (component is AssistantProviderSelection providerSelection) if (component is AssistantProviderSelection providerSelection)
{ {
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/> <ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
} }
break; break;
case AssistantUiCompontentType.PROFILE_SELECTION: case AssistantComponentType.PROFILE_SELECTION:
if (component is AssistantProfileSelection profileSelection) if (component is AssistantProfileSelection profileSelection)
{ {
var selection = profileSelection; var selection = profileSelection;
<ProfileFormSelection Validation="@((Profile profile) => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile"/> <ProfileFormSelection Validation="@((Profile profile) => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile"/>
} }
break; break;
case AssistantUiCompontentType.SWITCH: case AssistantComponentType.SWITCH:
if (component is AssistantSwitch assistantSwitch) if (component is AssistantSwitch assistantSwitch)
{ {
<MudTextSwitch Label="@assistantSwitch.Label" @bind-Value="@this.switchFields[assistantSwitch.Name]" LabelOn="@assistantSwitch.LabelOn" LabelOff="@assistantSwitch.LabelOff" /> <MudTextSwitch Label="@assistantSwitch.Label" @bind-Value="@this.switchFields[assistantSwitch.Name]" LabelOn="@assistantSwitch.LabelOn" LabelOff="@assistantSwitch.LabelOff" />
} }
break; break;
case AssistantUiCompontentType.HEADING: case AssistantComponentType.HEADING:
if (component is AssistantHeading assistantHeading) if (component is AssistantHeading assistantHeading)
{ {
var heading = assistantHeading; var heading = assistantHeading;
@ -99,14 +99,14 @@
} }
} }
break; break;
case AssistantUiCompontentType.TEXT: case AssistantComponentType.TEXT:
if (component is AssistantText assistantText) if (component is AssistantText assistantText)
{ {
var text = assistantText; var text = assistantText;
<MudText Typo="Typo.body1" Class="mb-3">@text.Content</MudText> <MudText Typo="Typo.body1" Class="mb-3">@text.Content</MudText>
} }
break; break;
case AssistantUiCompontentType.LIST: case AssistantComponentType.LIST:
if (component is AssistantList assistantList) if (component is AssistantList assistantList)
{ {
var list = assistantList; var list = assistantList;

View File

@ -63,25 +63,25 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
{ {
switch (component.Type) switch (component.Type)
{ {
case AssistantUiCompontentType.TEXT_AREA: case AssistantComponentType.TEXT_AREA:
if (component is AssistantTextArea textArea) if (component is AssistantTextArea textArea)
{ {
this.inputFields.Add(textArea.Name, textArea.PrefillText); this.inputFields.Add(textArea.Name, textArea.PrefillText);
} }
break; break;
case AssistantUiCompontentType.DROPDOWN: case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown dropdown) if (component is AssistantDropdown dropdown)
{ {
this.dropdownFields.Add(dropdown.Name, dropdown.Default.Value); this.dropdownFields.Add(dropdown.Name, dropdown.Default.Value);
} }
break; break;
case AssistantUiCompontentType.SWITCH: case AssistantComponentType.SWITCH:
if (component is AssistantSwitch switchComponent) if (component is AssistantSwitch switchComponent)
{ {
this.switchFields.Add(switchComponent.Name, switchComponent.Value); this.switchFields.Add(switchComponent.Name, switchComponent.Value);
} }
break; break;
case AssistantUiCompontentType.WEB_CONTENT_READER: case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent) if (component is AssistantWebContentReader webContent)
{ {
this.webContentFields.Add(webContent.Name, new WebContentState this.webContentFields.Add(webContent.Name, new WebContentState
@ -91,7 +91,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
}); });
} }
break; break;
case AssistantUiCompontentType.FILE_CONTENT_READER: case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent) if (component is AssistantFileContentReader fileContent)
{ {
this.fileContentFields.Add(fileContent.Name, new FileContentState()); this.fileContentFields.Add(fileContent.Name, new FileContentState());
@ -192,7 +192,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
var userDecision = false; var userDecision = false;
switch (component.Type) switch (component.Type)
{ {
case AssistantUiCompontentType.TEXT_AREA: case AssistantComponentType.TEXT_AREA:
if (component is AssistantTextArea textArea) if (component is AssistantTextArea textArea)
{ {
prompt += $"context:{Environment.NewLine}{textArea.UserPrompt}{Environment.NewLine}---{Environment.NewLine}"; prompt += $"context:{Environment.NewLine}{textArea.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -202,7 +202,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
} }
} }
break; break;
case AssistantUiCompontentType.DROPDOWN: case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown dropdown) if (component is AssistantDropdown dropdown)
{ {
prompt += $"{Environment.NewLine}context:{Environment.NewLine}{dropdown.UserPrompt}{Environment.NewLine}---{Environment.NewLine}"; prompt += $"{Environment.NewLine}context:{Environment.NewLine}{dropdown.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -212,7 +212,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
} }
} }
break; break;
case AssistantUiCompontentType.SWITCH: case AssistantComponentType.SWITCH:
if (component is AssistantSwitch switchComponent) if (component is AssistantSwitch switchComponent)
{ {
prompt += $"{Environment.NewLine}context:{Environment.NewLine}{switchComponent.UserPrompt}{Environment.NewLine}---{Environment.NewLine}"; prompt += $"{Environment.NewLine}context:{Environment.NewLine}{switchComponent.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -222,7 +222,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
} }
} }
break; break;
case AssistantUiCompontentType.WEB_CONTENT_READER: case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent && if (component is AssistantWebContentReader webContent &&
this.webContentFields.TryGetValue(webContent.Name, out var webState)) this.webContentFields.TryGetValue(webContent.Name, out var webState))
{ {
@ -237,7 +237,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
} }
} }
break; break;
case AssistantUiCompontentType.FILE_CONTENT_READER: case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent && if (component is AssistantFileContentReader fileContent &&
this.fileContentFields.TryGetValue(fileContent.Name, out var fileState)) this.fileContentFields.TryGetValue(fileContent.Name, out var fileState))
{ {

View File

@ -7,37 +7,37 @@ public class AssistantComponentFactory
private static readonly ILogger<AssistantComponentFactory> LOGGER = Program.LOGGER_FACTORY.CreateLogger<AssistantComponentFactory>(); private static readonly ILogger<AssistantComponentFactory> LOGGER = Program.LOGGER_FACTORY.CreateLogger<AssistantComponentFactory>();
public static IAssistantComponent CreateComponent( public static IAssistantComponent CreateComponent(
AssistantUiCompontentType type, AssistantComponentType type,
Dictionary<string, object> props, Dictionary<string, object> props,
List<IAssistantComponent> children) List<IAssistantComponent> children)
{ {
switch (type) switch (type)
{ {
case AssistantUiCompontentType.FORM: case AssistantComponentType.FORM:
return new AssistantForm { Props = props, Children = children }; return new AssistantForm { Props = props, Children = children };
case AssistantUiCompontentType.TEXT_AREA: case AssistantComponentType.TEXT_AREA:
return new AssistantTextArea { Props = props, Children = children }; return new AssistantTextArea { Props = props, Children = children };
case AssistantUiCompontentType.BUTTON: case AssistantComponentType.BUTTON:
return new AssistantButton { Props = props, Children = children}; return new AssistantButton { Props = props, Children = children};
case AssistantUiCompontentType.DROPDOWN: case AssistantComponentType.DROPDOWN:
return new AssistantDropdown { Props = props, Children = children }; return new AssistantDropdown { Props = props, Children = children };
case AssistantUiCompontentType.PROVIDER_SELECTION: case AssistantComponentType.PROVIDER_SELECTION:
return new AssistantProviderSelection { Props = props, Children = children }; return new AssistantProviderSelection { Props = props, Children = children };
case AssistantUiCompontentType.PROFILE_SELECTION: case AssistantComponentType.PROFILE_SELECTION:
return new AssistantProfileSelection { Props = props, Children = children }; return new AssistantProfileSelection { Props = props, Children = children };
case AssistantUiCompontentType.SWITCH: case AssistantComponentType.SWITCH:
return new AssistantSwitch { Props = props, Children = children }; return new AssistantSwitch { Props = props, Children = children };
case AssistantUiCompontentType.HEADING: case AssistantComponentType.HEADING:
return new AssistantHeading { Props = props, Children = children }; return new AssistantHeading { Props = props, Children = children };
case AssistantUiCompontentType.TEXT: case AssistantComponentType.TEXT:
return new AssistantText { Props = props, Children = children }; return new AssistantText { Props = props, Children = children };
case AssistantUiCompontentType.LIST: case AssistantComponentType.LIST:
return new AssistantList { Props = props, Children = children }; return new AssistantList { Props = props, Children = children };
case AssistantUiCompontentType.WEB_CONTENT_READER: case AssistantComponentType.WEB_CONTENT_READER:
return new AssistantWebContentReader { Props = props, Children = children }; return new AssistantWebContentReader { Props = props, Children = children };
case AssistantUiCompontentType.FILE_CONTENT_READER: case AssistantComponentType.FILE_CONTENT_READER:
return new AssistantFileContentReader { Props = props, Children = children }; return new AssistantFileContentReader { Props = props, Children = children };
case AssistantUiCompontentType.IMAGE: case AssistantComponentType.IMAGE:
return new AssistantImage { Props = props, Children = children }; return new AssistantImage { Props = props, Children = children };
default: default:
LOGGER.LogError($"Unknown assistant component type!\n{type} is not a supported assistant component type"); LOGGER.LogError($"Unknown assistant component type!\n{type} is not a supported assistant component type");

View File

@ -2,7 +2,7 @@
public class AssistantButton : AssistantComponentBase public class AssistantButton : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.BUTTON; public override AssistantComponentType Type => AssistantComponentType.BUTTON;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
public abstract class AssistantComponentBase : IAssistantComponent public abstract class AssistantComponentBase : IAssistantComponent
{ {
public abstract AssistantUiCompontentType Type { get; } public abstract AssistantComponentType Type { get; }
public Dictionary<string, object> Props { get; } public Dictionary<string, object> Props { get; }
public List<IAssistantComponent> Children { get; } public List<IAssistantComponent> Children { get; }
} }

View File

@ -1,6 +1,6 @@
namespace AIStudio.Tools.PluginSystem.Assistants.DataModel; namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public enum AssistantUiCompontentType public enum AssistantComponentType
{ {
FORM, FORM,
TEXT_AREA, TEXT_AREA,

View File

@ -2,7 +2,7 @@
public class AssistantDropdown : AssistantComponentBase public class AssistantDropdown : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.DROPDOWN; public override AssistantComponentType Type => AssistantComponentType.DROPDOWN;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantFileContentReader : AssistantComponentBase public class AssistantFileContentReader : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.FILE_CONTENT_READER; public override AssistantComponentType Type => AssistantComponentType.FILE_CONTENT_READER;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
public class AssistantForm : AssistantComponentBase public class AssistantForm : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.FORM; public override AssistantComponentType Type => AssistantComponentType.FORM;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();
} }

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantHeading : AssistantComponentBase public class AssistantHeading : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.HEADING; public override AssistantComponentType Type => AssistantComponentType.HEADING;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantImage : AssistantComponentBase public class AssistantImage : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.IMAGE; public override AssistantComponentType Type => AssistantComponentType.IMAGE;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantList : AssistantComponentBase public class AssistantList : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.LIST; public override AssistantComponentType Type => AssistantComponentType.LIST;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();

View File

@ -4,7 +4,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantProfileSelection : AssistantComponentBase public class AssistantProfileSelection : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.PROFILE_SELECTION; public override AssistantComponentType Type => AssistantComponentType.PROFILE_SELECTION;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
public class AssistantProviderSelection : AssistantComponentBase public class AssistantProviderSelection : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.PROVIDER_SELECTION; public override AssistantComponentType Type => AssistantComponentType.PROVIDER_SELECTION;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
public class AssistantSwitch : AssistantComponentBase public class AssistantSwitch : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.SWITCH; public override AssistantComponentType Type => AssistantComponentType.SWITCH;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantText : AssistantComponentBase public class AssistantText : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.TEXT; public override AssistantComponentType Type => AssistantComponentType.TEXT;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();

View File

@ -2,7 +2,7 @@
public class AssistantTextArea : AssistantComponentBase public class AssistantTextArea : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.TEXT_AREA; public override AssistantComponentType Type => AssistantComponentType.TEXT_AREA;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
public class AssistantWebContentReader : AssistantComponentBase public class AssistantWebContentReader : AssistantComponentBase
{ {
public override AssistantUiCompontentType Type => AssistantUiCompontentType.WEB_CONTENT_READER; public override AssistantComponentType Type => AssistantComponentType.WEB_CONTENT_READER;
public Dictionary<string, object> Props { get; set; } = new(); public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new(); public List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,58 +2,58 @@
public static class ComponentPropSpecs public static class ComponentPropSpecs
{ {
public static readonly IReadOnlyDictionary<AssistantUiCompontentType, PropSpec> SPECS = public static readonly IReadOnlyDictionary<AssistantComponentType, PropSpec> SPECS =
new Dictionary<AssistantUiCompontentType, PropSpec> new Dictionary<AssistantComponentType, PropSpec>
{ {
[AssistantUiCompontentType.FORM] = new( [AssistantComponentType.FORM] = new(
required: ["Children"], required: ["Children"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.TEXT_AREA] = new( [AssistantComponentType.TEXT_AREA] = new(
required: ["Name", "Label"], required: ["Name", "Label"],
optional: ["UserPrompt", "PrefillText", "ReadOnly", "IsSingleLine"] optional: ["UserPrompt", "PrefillText", "ReadOnly", "IsSingleLine"]
), ),
[AssistantUiCompontentType.BUTTON] = new( [AssistantComponentType.BUTTON] = new(
required: ["Name", "Text", "Action"], required: ["Name", "Text", "Action"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.DROPDOWN] = new( [AssistantComponentType.DROPDOWN] = new(
required: ["Name", "Label", "Default", "Items"], required: ["Name", "Label", "Default", "Items"],
optional: ["UserPrompt"] optional: ["UserPrompt"]
), ),
[AssistantUiCompontentType.PROVIDER_SELECTION] = new( [AssistantComponentType.PROVIDER_SELECTION] = new(
required: ["Name", "Label"], required: ["Name", "Label"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.PROFILE_SELECTION] = new( [AssistantComponentType.PROFILE_SELECTION] = new(
required: [], required: [],
optional: ["ValidationMessage"] optional: ["ValidationMessage"]
), ),
[AssistantUiCompontentType.SWITCH] = new( [AssistantComponentType.SWITCH] = new(
required: ["Name", "Label", "LabelOn", "LabelOff", "Value"], required: ["Name", "Label", "LabelOn", "LabelOff", "Value"],
optional: ["UserPrompt"] optional: ["UserPrompt"]
), ),
[AssistantUiCompontentType.HEADING] = new( [AssistantComponentType.HEADING] = new(
required: ["Text", "Level"], required: ["Text", "Level"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.TEXT] = new( [AssistantComponentType.TEXT] = new(
required: ["Content"], required: ["Content"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.LIST] = new( [AssistantComponentType.LIST] = new(
required: ["Items"], required: ["Items"],
optional: [] optional: []
), ),
[AssistantUiCompontentType.WEB_CONTENT_READER] = new( [AssistantComponentType.WEB_CONTENT_READER] = new(
required: ["Name"], required: ["Name"],
optional: ["UserPrompt", "Preselect", "PreselectContentCleanerAgent"] optional: ["UserPrompt", "Preselect", "PreselectContentCleanerAgent"]
), ),
[AssistantUiCompontentType.FILE_CONTENT_READER] = new( [AssistantComponentType.FILE_CONTENT_READER] = new(
required: ["Name"], required: ["Name"],
optional: ["UserPrompt"] optional: ["UserPrompt"]
), ),
[AssistantUiCompontentType.IMAGE] = new( [AssistantComponentType.IMAGE] = new(
required: ["Src"], required: ["Src"],
optional: ["Alt", "Caption"] optional: ["Alt", "Caption"]
), ),

View File

@ -2,7 +2,7 @@
public interface IAssistantComponent public interface IAssistantComponent
{ {
AssistantUiCompontentType Type { get; } AssistantComponentType Type { get; }
Dictionary<string, object> Props { get; } Dictionary<string, object> Props { get; }
List<IAssistantComponent> Children { get; } List<IAssistantComponent> Children { get; }
} }

View File

@ -116,8 +116,8 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
if (!uiTable.TryGetValue("Type", out var typeVal) if (!uiTable.TryGetValue("Type", out var typeVal)
|| !typeVal.TryRead<string>(out var typeText) || !typeVal.TryRead<string>(out var typeText)
|| !Enum.TryParse<AssistantUiCompontentType>(typeText, true, out var type) || !Enum.TryParse<AssistantComponentType>(typeText, true, out var type)
|| type != AssistantUiCompontentType.FORM) || type != AssistantComponentType.FORM)
{ {
LOGGER.LogWarning("UI table of the ASSISTANT table has no valid Form type."); LOGGER.LogWarning("UI table of the ASSISTANT table has no valid Form type.");
return false; return false;
@ -150,7 +150,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
children.Add(comp); children.Add(comp);
} }
root = AssistantComponentFactory.CreateComponent(AssistantUiCompontentType.FORM, new Dictionary<string, object>(), children); root = AssistantComponentFactory.CreateComponent(AssistantComponentType.FORM, new Dictionary<string, object>(), children);
return true; return true;
} }
@ -168,13 +168,13 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
if (!componentTable.TryGetValue("Type", out var typeVal) if (!componentTable.TryGetValue("Type", out var typeVal)
|| !typeVal.TryRead<string>(out var typeText) || !typeVal.TryRead<string>(out var typeText)
|| !Enum.TryParse<AssistantUiCompontentType>(typeText, true, out var type)) || !Enum.TryParse<AssistantComponentType>(typeText, true, out var type))
{ {
LOGGER.LogWarning($"Component #{idx} missing valid Type."); LOGGER.LogWarning($"Component #{idx} missing valid Type.");
return false; return false;
} }
if (type == AssistantUiCompontentType.PROFILE_SELECTION) if (type == AssistantComponentType.PROFILE_SELECTION)
this.HasEmbeddedProfileSelection = true; this.HasEmbeddedProfileSelection = true;
Dictionary<string, object> props = new(); Dictionary<string, object> props = new();
@ -206,7 +206,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
} }
private bool TryReadComponentProps( private bool TryReadComponentProps(
AssistantUiCompontentType type, AssistantComponentType type,
LuaTable propsTable, LuaTable propsTable,
out Dictionary<string, object> props) out Dictionary<string, object> props)
{ {