AI-Studio/app/MindWork AI Studio/Assistants/AssistantBase.razor

120 lines
5.2 KiB
Plaintext
Raw Normal View History

2024-07-14 19:46:17 +00:00
@using AIStudio.Chat
2024-08-21 06:30:01 +00:00
2024-07-14 19:46:17 +00:00
<MudText Typo="Typo.h3" Class="mb-2 mr-3">
2024-08-18 19:48:35 +00:00
@(this.Title)
2024-07-14 19:46:17 +00:00
</MudText>
<InnerScrolling HeaderHeight="6em">
2024-07-14 19:46:17 +00:00
<ChildContent>
2024-08-18 19:48:35 +00:00
<MudForm @ref="@(this.form)" @bind-IsValid="@(this.inputIsValid)" @bind-Errors="@(this.inputIssues)" Class="pr-2">
2024-07-14 19:46:17 +00:00
<MudText Typo="Typo.body1" Align="Align.Justify" Class="mb-6">
2024-09-11 21:08:02 +00:00
@this.Description
2024-07-14 19:46:17 +00:00
</MudText>
@if (this.Body is not null)
{
<CascadingValue Value="@this">
@this.Body
</CascadingValue>
2024-09-11 21:08:02 +00:00
<MudButton Disabled="@this.SubmitDisabled" Variant="Variant.Filled" Class="mb-3" OnClick="() => this.SubmitAction()" Style="@this.SubmitButtonStyle">
@this.SubmitText
</MudButton>
2024-07-14 19:46:17 +00:00
}
</MudForm>
2024-08-18 19:48:35 +00:00
<Issues IssuesData="@(this.inputIssues)"/>
@if (this.ShowDedicatedProgress && this.isProcessing)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mb-6" />
}
2024-08-21 06:30:01 +00:00
<div id="@RESULT_DIV_ID" class="mr-2 mt-3">
</div>
<div id="@BEFORE_RESULT_DIV_ID" class="mt-3">
</div>
@if (this.ShowResult && this.resultingContentBlock is not null)
{
<ContentBlockComponent Role="@(this.resultingContentBlock.Role)" Type="@(this.resultingContentBlock.ContentType)" Time="@(this.resultingContentBlock.Time)" Content="@(this.resultingContentBlock.Content)"/>
}
<div id="@AFTER_RESULT_DIV_ID" class="mt-3">
</div>
</ChildContent>
<FooterContent>
2024-09-04 13:44:23 +00:00
<MudStack Row="@true" Wrap="Wrap.Wrap" Class="ma-1">
@if (!this.FooterButtons.Any(x => x.Type is ButtonTypes.SEND_TO))
{
2024-10-28 14:41:00 +00:00
@if (this.ShowSendTo)
{
<MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
2024-10-28 14:41:00 +00:00
{
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, new())">
@assistant.Name()
</MudMenuItem>
}
</MudMenu>
}
2024-09-04 13:44:23 +00:00
}
2024-09-04 13:44:23 +00:00
@foreach (var button in this.FooterButtons)
{
switch (button)
{
case ButtonData buttonData when !string.IsNullOrWhiteSpace(buttonData.Tooltip):
<MudTooltip Text="@buttonData.Tooltip">
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="async () => await buttonData.AsyncAction()">
@buttonData.Text
</MudButton>
2024-09-04 13:44:23 +00:00
</MudTooltip>
break;
2024-09-04 13:44:23 +00:00
case ButtonData buttonData:
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="async () => await buttonData.AsyncAction()">
@buttonData.Text
</MudButton>
break;
2024-09-04 13:44:23 +00:00
case SendToButton sendToButton:
<MudMenu StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="Send to ..." Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
2024-09-04 13:44:23 +00:00
{
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">
@assistant.Name()
</MudMenuItem>
}
</MudMenu>
break;
}
2024-09-04 13:44:23 +00:00
}
2024-10-28 14:41:00 +00:00
@if (this.ShowCopyResult)
{
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.ContentCopy" OnClick="() => this.CopyToClipboard()">
Copy result
</MudButton>
}
@if (this.ShowReset)
{
<MudButton Variant="Variant.Filled" Style="@this.GetResetColor()" StartIcon="@Icons.Material.Filled.Refresh" OnClick="() => this.InnerResetForm()">
Reset
</MudButton>
}
2024-09-11 21:08:02 +00:00
@if (this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence)
{
<ConfidenceInfo Mode="ConfidenceInfoMode.BUTTON" LLMProvider="@this.providerSettings.UsedLLMProvider"/>
2024-09-11 21:08:02 +00:00
}
@if (this.AllowProfiles && this.ShowProfileSelection)
2024-09-08 19:01:51 +00:00
{
<ProfileSelection MarginLeft="" @bind-CurrentProfile="@this.currentProfile"/>
}
2024-09-04 13:44:23 +00:00
</MudStack>
</FooterContent>
2024-07-14 19:46:17 +00:00
</InnerScrolling>