mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-04-09 18:01:37 +00:00
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
119 lines
4.6 KiB
C#
119 lines
4.6 KiB
C#
namespace AIStudio.Tools.PluginSystem.Assistants.DataModel;
|
|
|
|
internal sealed class AssistantTextArea : StatefulAssistantComponentBase
|
|
{
|
|
public override AssistantComponentType Type => AssistantComponentType.TEXT_AREA;
|
|
public override Dictionary<string, object> Props { get; set; } = new();
|
|
public override List<IAssistantComponent> Children { get; set; } = new();
|
|
|
|
public string Label
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Label));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Label), value);
|
|
}
|
|
|
|
public string HelperText
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.HelperText));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.HelperText), value);
|
|
}
|
|
|
|
public bool HelperTextOnFocus
|
|
{
|
|
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.HelperTextOnFocus));
|
|
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.HelperTextOnFocus), value);
|
|
}
|
|
|
|
public string Adornment
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Adornment));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Adornment), value);
|
|
}
|
|
|
|
public string AdornmentIcon
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.AdornmentIcon));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.AdornmentIcon), value);
|
|
}
|
|
|
|
public string AdornmentText
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.AdornmentText));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.AdornmentText), value);
|
|
}
|
|
|
|
public string AdornmentColor
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.AdornmentColor));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.AdornmentColor), value);
|
|
}
|
|
|
|
public string PrefillText
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.PrefillText));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.PrefillText), value);
|
|
}
|
|
|
|
public int? Counter
|
|
{
|
|
get => AssistantComponentPropHelper.ReadNullableInt(this.Props, nameof(this.Counter));
|
|
set => AssistantComponentPropHelper.WriteNullableInt(this.Props, nameof(this.Counter), value);
|
|
}
|
|
|
|
public int MaxLength
|
|
{
|
|
get => AssistantComponentPropHelper.ReadInt(this.Props, nameof(this.MaxLength), PluginAssistants.TEXT_AREA_MAX_VALUE);
|
|
set => AssistantComponentPropHelper.WriteInt(this.Props, nameof(this.MaxLength), value);
|
|
}
|
|
|
|
public bool IsImmediate
|
|
{
|
|
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.IsImmediate));
|
|
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.IsImmediate), value);
|
|
}
|
|
|
|
public bool IsSingleLine
|
|
{
|
|
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.IsSingleLine));
|
|
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.IsSingleLine), value);
|
|
}
|
|
|
|
public bool ReadOnly
|
|
{
|
|
get => AssistantComponentPropHelper.ReadBool(this.Props, nameof(this.ReadOnly));
|
|
set => AssistantComponentPropHelper.WriteBool(this.Props, nameof(this.ReadOnly), value);
|
|
}
|
|
|
|
public string Class
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Class));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Class), value);
|
|
}
|
|
|
|
public string Style
|
|
{
|
|
get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Style));
|
|
set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Style), value);
|
|
}
|
|
|
|
#region Implementation of IStatefulAssistantComponent
|
|
|
|
public override void InitializeState(AssistantState state)
|
|
{
|
|
if (!state.Text.ContainsKey(this.Name))
|
|
state.Text[this.Name] = this.PrefillText;
|
|
}
|
|
|
|
public override string UserPromptFallback(AssistantState state)
|
|
{
|
|
state.Text.TryGetValue(this.Name, out var userInput);
|
|
return this.BuildAuditPromptBlock(userInput);
|
|
}
|
|
|
|
#endregion
|
|
|
|
public Adornment GetAdornmentPos() => Enum.TryParse<Adornment>(this.Adornment, out var position) ? position : MudBlazor.Adornment.Start;
|
|
|
|
public Color GetAdornmentColor() => Enum.TryParse<Color>(this.AdornmentColor, out var color) ? color : Color.Default;
|
|
}
|