mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 13:01:37 +00:00
started with the rendering of dynamic assistants
This commit is contained in:
parent
aa31fa7182
commit
09b187d3f7
@ -0,0 +1,27 @@
|
||||
@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
|
||||
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
|
||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogDynamic>
|
||||
|
||||
@foreach (var component in this.RootComponent!.Children)
|
||||
{
|
||||
@switch (component.Type)
|
||||
{
|
||||
case AssistantUiCompontentType.TEXT_AREA:
|
||||
if (component is AssistantTextArea textArea)
|
||||
{
|
||||
<MudTextField T="string" @bind-Text="@this.inputText" Label="@textArea.Label" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3"/>
|
||||
}
|
||||
break;
|
||||
|
||||
case AssistantUiCompontentType.PROVIDER_SELECTION:
|
||||
if (component is AssistantProviderSelection providerSelection)
|
||||
{
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
using AIStudio.Dialogs.Settings;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
using AIStudio.Tools.PluginSystem.Assistants;
|
||||
using AIStudio.Tools.PluginSystem.Assistants.DataModel;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Assistants.Dynamic;
|
||||
|
||||
public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
|
||||
{
|
||||
[Parameter]
|
||||
public AssistantForm? RootComponent { get; set; } = null!;
|
||||
|
||||
private string? inputText;
|
||||
private string title = string.Empty;
|
||||
private string description = string.Empty;
|
||||
private string systemPrompt = string.Empty;
|
||||
private bool allowProfiles = true;
|
||||
|
||||
protected override string Title => this.title;
|
||||
protected override string Description => this.description;
|
||||
protected override string SystemPrompt => this.systemPrompt;
|
||||
protected override bool AllowProfiles => this.allowProfiles;
|
||||
public override Tools.Components Component { get; }
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var guid = Guid.Parse("958312de-a9e7-4666-901f-4d5b61647efb");
|
||||
var plugin = PluginFactory.RunningPlugins.FirstOrDefault(e => e.Id == guid);
|
||||
if (plugin is PluginAssistants assistantPlugin)
|
||||
{
|
||||
this.RootComponent = assistantPlugin.RootComponent;
|
||||
this.title = assistantPlugin.AssistantTitle;
|
||||
this.description = assistantPlugin.AssistantDescription;
|
||||
this.systemPrompt = assistantPlugin.SystemPrompt;
|
||||
this.allowProfiles = assistantPlugin.AllowProfiles;
|
||||
}
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
protected override void ResetForm()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override bool MightPreselectValues()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override string SubmitText { get; }
|
||||
protected override Func<Task> SubmitAction { get; }
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user