mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 12:49:07 +00:00
All assistants now have a button to copy their respective result to the clipboard (#86)
This commit is contained in:
parent
18718a6c47
commit
3409872090
@ -70,6 +70,9 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.ContentCopy" OnClick="() => this.CopyToClipboard()">
|
||||
Copy result
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Warning" StartIcon="@Icons.Material.Filled.Refresh" OnClick="() => this.InnerResetForm()">
|
||||
Reset
|
||||
</MudButton>
|
||||
|
@ -36,6 +36,12 @@ public abstract partial class AssistantBase : ComponentBase
|
||||
|
||||
protected abstract string SystemPrompt { get; }
|
||||
|
||||
protected virtual Func<string> Result2Copy => () => this.resultingContentBlock is null ? string.Empty : this.resultingContentBlock.Content switch
|
||||
{
|
||||
ContentText textBlock => textBlock.Text,
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
protected abstract void ResetFrom();
|
||||
|
||||
protected abstract bool MightPreselectValues();
|
||||
@ -154,9 +160,9 @@ public abstract partial class AssistantBase : ComponentBase
|
||||
return aiText.Text;
|
||||
}
|
||||
|
||||
protected async Task CopyToClipboard(string text)
|
||||
protected async Task CopyToClipboard()
|
||||
{
|
||||
await this.Rust.CopyText2Clipboard(this.JsRuntime, this.Snackbar, text);
|
||||
await this.Rust.CopyText2Clipboard(this.JsRuntime, this.Snackbar, this.Result2Copy());
|
||||
}
|
||||
|
||||
private static string? GetButtonIcon(string icon)
|
||||
|
@ -26,9 +26,10 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore
|
||||
|
||||
protected override bool ShowDedicatedProgress => true;
|
||||
|
||||
protected override Func<string> Result2Copy => () => this.correctedText;
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.correctedText)),
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendTo.GRAMMAR_SPELLING_ASSISTANT,
|
||||
|
@ -27,9 +27,10 @@ public partial class AssistantRewriteImprove : AssistantBaseCore
|
||||
|
||||
protected override bool ShowDedicatedProgress => true;
|
||||
|
||||
protected override Func<string> Result2Copy => () => this.rewrittenText;
|
||||
|
||||
protected override IReadOnlyList<IButtonData> FooterButtons =>
|
||||
[
|
||||
new ButtonData("Copy result", Icons.Material.Filled.ContentCopy, Color.Default, string.Empty, () => this.CopyToClipboard(this.rewrittenText)),
|
||||
new SendToButton
|
||||
{
|
||||
Self = SendTo.REWRITE_ASSISTANT,
|
||||
|
@ -1,6 +1,7 @@
|
||||
# v0.8.12, build 174
|
||||
- Added an e-mail writing assistant.
|
||||
- Added the possibility to preselect some e-mail writing assistant options.
|
||||
- Improved: all assistants now have a button to copy their respective result to the clipboard.
|
||||
- Improved the content validation for the agenda assistant.
|
||||
- Improved the language handling of the agenda assistant.
|
||||
- Refactored the "send to" implementation of assistants.
|
Loading…
Reference in New Issue
Block a user