All assistants now have a button to copy their respective result to the clipboard (#86)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-08-23 08:59:30 +02:00
1 parent 18718a6c47
commit 3409872090
5 files changed
+16 -4

No files matched your search

@@ -35,6 +35,12 @@ public abstract partial class AssistantBase : ComponentBase
protected abstract string Description { get; }
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();
@@ -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)