Added a way to read what the AI received from your sources (#1100)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Paul KoudelkaandThorsten Sommer authored and GitHub committed 2026-10-26 10:00:01 +01:00
1 parent e0d8e18f34
commit cbc4ce5413
229 files changed
+12739 -1269

No files matched your search

@@ -81,6 +81,16 @@ public partial class AttachDocuments : MSGComponentBase
[Parameter]
public Func<string, Task<ChatThread?>> EnsureOwnerChatAsync { get; set; } = _ => Task.FromResult<ChatThread?>(null);
/// <summary>
/// Keeps what the preview read of an attached document, so that sending it does not read the file again.
/// </summary>
/// <remarks>
/// Only the chat hands one over, cf. DocumentCheckDialog.KeepReadText. Elsewhere, e.g., in the
/// assistants, the documents are read for every run anyway.
/// </remarks>
[Parameter]
public Func<FileAttachment, string, FileVersion, Task>? KeepPreviewedText { get; set; }
[Inject]
private ILogger<AttachDocuments> Logger { get; set; } = null!;
@@ -263,7 +273,7 @@ public partial class AttachDocuments : MSGComponentBase
return;
var previousAttachments = this.DocumentPaths.ToHashSet();
this.DocumentPaths = await ReviewAttachmentsDialog.OpenDialogAsync(this.DialogService, this.DocumentPaths, this.AttachDroppedPathsAsync, () => this.IsUnavailable);
this.DocumentPaths = await ReviewAttachmentsDialog.OpenDialogAsync(this.DialogService, this.DocumentPaths, this.AttachDroppedPathsAsync, () => this.IsUnavailable, this.KeepPreviewedText);
var removedAttachments = previousAttachments.Except(this.DocumentPaths).ToList();
foreach (var removedAttachment in removedAttachments)
ManagedTranscriptAttachment.TryDeleteOwnedFile(removedAttachment);
@@ -383,7 +393,7 @@ public partial class AttachDocuments : MSGComponentBase
// about whether it happened to be new to us.
//
var attachment = FileAttachment.FromPath(path);
this.DocumentPaths.Add(attachment);
this.DocumentPaths.AttachInPlaceOfSameFile(attachment);
attached.Add(attachment);
}
@@ -452,6 +462,7 @@ public partial class AttachDocuments : MSGComponentBase
{ x => x.Document, fileAttachment },
{ x => x.AttachPaths, this.AttachDroppedPathsAsync },
{ x => x.IsAttachingUnavailable, () => this.IsUnavailable },
{ x => x.KeepReadText, this.KeepPreviewedText },
};
await this.DialogService.ShowAsync<DocumentCheckDialog>(T("Document Preview"), dialogParameters, DialogOptions.FULLSCREEN);