mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-06-27 14:56:27 +00:00
added a dialog for the assistant draft that lets users review and edit the models decision
This commit is contained in:
parent
57bebfe1b1
commit
04d93394ef
30
app/MindWork AI Studio/Dialogs/AssistantDraftDialog.razor
Normal file
30
app/MindWork AI Studio/Dialogs/AssistantDraftDialog.razor
Normal file
@ -0,0 +1,30 @@
|
||||
@inherits MSGComponentBase
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@T("Review the assistant draft before AI Studio generates the Lua plugin. You can edit the Markdown draft if something should be changed.")
|
||||
</MudJustifiedText>
|
||||
|
||||
<MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" PanelClass="pa-2" Class="mb-2">
|
||||
<MudTabPanel Text="@T("Preview")" Icon="@Icons.Material.Filled.Article">
|
||||
<MudField Variant="Variant.Outlined" AdornmentIcon="@Icons.Material.Filled.Visibility" Adornment="Adornment.Start" Label="@T("Assistant draft")" FullWidth="true" Class="ma-2 pe-4">
|
||||
<div style="max-height: 58vh; overflow-y: auto;">
|
||||
<MudMarkdown Value="@this.DraftMarkdown" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling" MarkdownPipeline="Markdown.SAFE_MARKDOWN_PIPELINE"/>
|
||||
</div>
|
||||
</MudField>
|
||||
</MudTabPanel>
|
||||
<MudTabPanel Text="@T("Edit")" Icon="@Icons.Material.Filled.Edit">
|
||||
<MudTextField T="string" @bind-Text="@this.DraftMarkdown" AdornmentIcon="@Icons.Material.Filled.EditNote" Adornment="Adornment.Start" Label="@T("Assistant draft Markdown")" Variant="Variant.Outlined" Lines="16" AutoGrow="@true" MaxLines="32" Class="ma-2"/>
|
||||
</MudTabPanel>
|
||||
</MudTabs>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">
|
||||
@T("Cancel")
|
||||
</MudButton>
|
||||
<MudButton OnClick="@this.Confirm" Variant="Variant.Filled" Color="Color.Primary">
|
||||
@T("Use this draft")
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
24
app/MindWork AI Studio/Dialogs/AssistantDraftDialog.razor.cs
Normal file
24
app/MindWork AI Studio/Dialogs/AssistantDraftDialog.razor.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using AIStudio.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Dialogs;
|
||||
|
||||
public partial class AssistantDraftDialog : MSGComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public string DraftMarkdown { get; set; } = string.Empty;
|
||||
|
||||
private void Cancel() => this.MudDialog.Cancel();
|
||||
|
||||
private void Confirm() => this.MudDialog.Close(DialogResult.Ok(this.DraftMarkdown));
|
||||
|
||||
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
||||
|
||||
private MudMarkdownStyling MarkdownStyling => new()
|
||||
{
|
||||
CodeBlock = { Theme = this.CodeColorPalette },
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user