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

View File

@ -63,25 +63,25 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
{
switch (component.Type)
{
case AssistantUiCompontentType.TEXT_AREA:
case AssistantComponentType.TEXT_AREA:
if (component is AssistantTextArea textArea)
{
this.inputFields.Add(textArea.Name, textArea.PrefillText);
}
break;
case AssistantUiCompontentType.DROPDOWN:
case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown dropdown)
{
this.dropdownFields.Add(dropdown.Name, dropdown.Default.Value);
}
break;
case AssistantUiCompontentType.SWITCH:
case AssistantComponentType.SWITCH:
if (component is AssistantSwitch switchComponent)
{
this.switchFields.Add(switchComponent.Name, switchComponent.Value);
}
break;
case AssistantUiCompontentType.WEB_CONTENT_READER:
case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent)
{
this.webContentFields.Add(webContent.Name, new WebContentState
@ -91,7 +91,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
});
}
break;
case AssistantUiCompontentType.FILE_CONTENT_READER:
case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent)
{
this.fileContentFields.Add(fileContent.Name, new FileContentState());
@ -192,7 +192,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
var userDecision = false;
switch (component.Type)
{
case AssistantUiCompontentType.TEXT_AREA:
case AssistantComponentType.TEXT_AREA:
if (component is AssistantTextArea textArea)
{
prompt += $"context:{Environment.NewLine}{textArea.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -202,7 +202,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
}
}
break;
case AssistantUiCompontentType.DROPDOWN:
case AssistantComponentType.DROPDOWN:
if (component is AssistantDropdown dropdown)
{
prompt += $"{Environment.NewLine}context:{Environment.NewLine}{dropdown.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -212,7 +212,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
}
}
break;
case AssistantUiCompontentType.SWITCH:
case AssistantComponentType.SWITCH:
if (component is AssistantSwitch switchComponent)
{
prompt += $"{Environment.NewLine}context:{Environment.NewLine}{switchComponent.UserPrompt}{Environment.NewLine}---{Environment.NewLine}";
@ -222,7 +222,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
}
}
break;
case AssistantUiCompontentType.WEB_CONTENT_READER:
case AssistantComponentType.WEB_CONTENT_READER:
if (component is AssistantWebContentReader webContent &&
this.webContentFields.TryGetValue(webContent.Name, out var webState))
{
@ -237,7 +237,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
}
}
break;
case AssistantUiCompontentType.FILE_CONTENT_READER:
case AssistantComponentType.FILE_CONTENT_READER:
if (component is AssistantFileContentReader fileContent &&
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>();
public static IAssistantComponent CreateComponent(
AssistantUiCompontentType type,
AssistantComponentType type,
Dictionary<string, object> props,
List<IAssistantComponent> children)
{
switch (type)
{
case AssistantUiCompontentType.FORM:
case AssistantComponentType.FORM:
return new AssistantForm { Props = props, Children = children };
case AssistantUiCompontentType.TEXT_AREA:
case AssistantComponentType.TEXT_AREA:
return new AssistantTextArea { Props = props, Children = children };
case AssistantUiCompontentType.BUTTON:
case AssistantComponentType.BUTTON:
return new AssistantButton { Props = props, Children = children};
case AssistantUiCompontentType.DROPDOWN:
case AssistantComponentType.DROPDOWN:
return new AssistantDropdown { Props = props, Children = children };
case AssistantUiCompontentType.PROVIDER_SELECTION:
case AssistantComponentType.PROVIDER_SELECTION:
return new AssistantProviderSelection { Props = props, Children = children };
case AssistantUiCompontentType.PROFILE_SELECTION:
case AssistantComponentType.PROFILE_SELECTION:
return new AssistantProfileSelection { Props = props, Children = children };
case AssistantUiCompontentType.SWITCH:
case AssistantComponentType.SWITCH:
return new AssistantSwitch { Props = props, Children = children };
case AssistantUiCompontentType.HEADING:
case AssistantComponentType.HEADING:
return new AssistantHeading { Props = props, Children = children };
case AssistantUiCompontentType.TEXT:
case AssistantComponentType.TEXT:
return new AssistantText { Props = props, Children = children };
case AssistantUiCompontentType.LIST:
case AssistantComponentType.LIST:
return new AssistantList { Props = props, Children = children };
case AssistantUiCompontentType.WEB_CONTENT_READER:
case AssistantComponentType.WEB_CONTENT_READER:
return new AssistantWebContentReader { Props = props, Children = children };
case AssistantUiCompontentType.FILE_CONTENT_READER:
case AssistantComponentType.FILE_CONTENT_READER:
return new AssistantFileContentReader { Props = props, Children = children };
case AssistantUiCompontentType.IMAGE:
case AssistantComponentType.IMAGE:
return new AssistantImage { Props = props, Children = children };
default:
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 override AssistantUiCompontentType Type => AssistantUiCompontentType.BUTTON;
public override AssistantComponentType Type => AssistantComponentType.BUTTON;
public Dictionary<string, object> Props { get; set; } = new();
public List<IAssistantComponent> Children { get; set; } = new();

View File

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

View File

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

View File

@ -2,7 +2,7 @@
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 List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
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 List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
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 List<IAssistantComponent> Children { get; set; } = new();
}

View File

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

View File

@ -2,7 +2,7 @@
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 List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@
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 List<IAssistantComponent> Children { get; set; } = new();

View File

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

View File

@ -2,7 +2,7 @@
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 List<IAssistantComponent> Children { get; set; } = new();

View File

@ -2,7 +2,7 @@ namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
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 List<IAssistantComponent> Children { get; set; } = new();

View File

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

View File

@ -2,7 +2,7 @@
public interface IAssistantComponent
{
AssistantUiCompontentType Type { get; }
AssistantComponentType Type { get; }
Dictionary<string, object> Props { 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)
|| !typeVal.TryRead<string>(out var typeText)
|| !Enum.TryParse<AssistantUiCompontentType>(typeText, true, out var type)
|| type != AssistantUiCompontentType.FORM)
|| !Enum.TryParse<AssistantComponentType>(typeText, true, out var type)
|| type != AssistantComponentType.FORM)
{
LOGGER.LogWarning("UI table of the ASSISTANT table has no valid Form type.");
return false;
@ -150,7 +150,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
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;
}
@ -168,13 +168,13 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
if (!componentTable.TryGetValue("Type", out var typeVal)
|| !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.");
return false;
}
if (type == AssistantUiCompontentType.PROFILE_SELECTION)
if (type == AssistantComponentType.PROFILE_SELECTION)
this.HasEmbeddedProfileSelection = true;
Dictionary<string, object> props = new();
@ -206,7 +206,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
}
private bool TryReadComponentProps(
AssistantUiCompontentType type,
AssistantComponentType type,
LuaTable propsTable,
out Dictionary<string, object> props)
{