mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 20:07:20 +00:00
Added an optional notice for AI-generated content (#884)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
f5a257270e
commit
249fc778a2
26 files changed
+406
-46
No files matched your search
@@ -20,6 +20,8 @@ public static class PandocExport
|
||||
/// This says nothing to the user: it reports what happened and lets the caller decide. A batch
|
||||
/// run over hundreds of documents would otherwise bury the user under notifications. Pandoc
|
||||
/// must be available, which PandocAvailabilityService.EnsureAvailabilityAsync takes care of.
|
||||
/// The text is converted as it is: whether it ends with the notice that AI generated it is up
|
||||
/// to the caller, which knows what the text is.
|
||||
/// </remarks>
|
||||
/// <param name="rustService">The Rust service, used to build the Pandoc call.</param>
|
||||
/// <param name="markdownText">The Markdown text to convert.</param>
|
||||
@@ -113,6 +115,9 @@ public static class PandocExport
|
||||
/// </summary>
|
||||
/// <param name="rustService">The Rust service, used for the save dialog and for Pandoc.</param>
|
||||
/// <param name="pandocAvailability">Makes sure Pandoc is there and offers its installation.</param>
|
||||
/// <param name="disclosureService">Ends the text with the notice that AI generated it, when that is
|
||||
/// switched on. Null for content which never gets the notice, such as the answer of the prompt
|
||||
/// optimizer, which is meant for another model.</param>
|
||||
/// <param name="dialogTitle">The title of the save dialog. The caller knows what the user is
|
||||
/// looking at, a chat message or the result of an assistant, so the caller names it.</param>
|
||||
/// <param name="format">The format to write. Must be a format which uses Pandoc.</param>
|
||||
@@ -120,7 +125,7 @@ public static class PandocExport
|
||||
/// <param name="fileName">What the document is about, used to suggest a name in the save dialog.
|
||||
/// Null falls back to a generic name.</param>
|
||||
/// <returns>True, when the document was written.</returns>
|
||||
public static async Task<bool> ToDocument(RustService rustService, PandocAvailabilityService pandocAvailability, string dialogTitle, FileExportFormat format, IContent markdownContent, string? fileName = null)
|
||||
public static async Task<bool> ToDocument(RustService rustService, PandocAvailabilityService pandocAvailability, AIGeneratedContentDisclosureService? disclosureService, string dialogTitle, FileExportFormat format, IContent markdownContent, string? fileName = null)
|
||||
{
|
||||
if (!format.UsesPandoc() || format.ToFileTypeFilter() is not { } fileTypeFilter)
|
||||
throw new ArgumentOutOfRangeException(nameof(format), format, "Pandoc cannot write this format.");
|
||||
@@ -136,6 +141,8 @@ public static class PandocExport
|
||||
return false;
|
||||
}
|
||||
|
||||
markdownText = disclosureService?.AddDisclosureToMarkdown(markdownText) ?? markdownText;
|
||||
|
||||
var response = await rustService.SaveFile(dialogTitle, [fileTypeFilter], format.ToSuggestedFileName(fileName));
|
||||
if (response.UserCancelled)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user