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

@@ -104,4 +104,14 @@ public sealed class DataChat(Expression<Func<Data, DataChat>>? configSelection =
/// Should we show the latest message after loading? When false, we show the first (aka oldest) message.
/// </summary>
public bool ShowLatestMessageAfterLoading { get; set; } = true;
/// <summary>
/// Whether a chat reads an attached file again when the file changed since it was sent.
/// </summary>
/// <remarks>
/// Off by default: every later message of a chat sends the text a file had when it was first
/// sent, so that what the AI received stays the same and can be shown as it was, see
/// FileAttachment.ProvenanceId. A file which is gone keeps its text either way.
/// </remarks>
public bool ReadChangedAttachmentsAgain { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ReadChangedAttachmentsAgain, false);
}
@@ -155,7 +155,9 @@ public readonly record struct DataSourceERI_V1 : IERIDataSource
if(retrievalResponse is { Successful: true, Data: not null })
{
//
// Next, we have to transform the ERI context back to our generic retrieval context:
// Next, we have to transform the ERI context back to our generic retrieval context.
// The server writes the JSON, and a field it leaves out arrives as null, whatever the
// contract says. Everything after this point counts on texts and lists:
//
var genericRetrievalContexts = new List<IRetrievalContext>(retrievalResponse.Data.Count);
foreach (var eriContext in retrievalResponse.Data)
@@ -167,26 +169,26 @@ public readonly record struct DataSourceERI_V1 : IERIDataSource
{
Path = eriContext.Path ?? string.Empty,
Type = eriContext.ToRetrievalContentType(),
Links = eriContext.Links,
Links = eriContext.Links ?? [],
Category = eriContext.Type.ToRetrievalContentCategory(),
SourceCategory = eriContext.Category ?? string.Empty,
MatchedText = eriContext.MatchedContent,
DataSourceName = eriContext.Name,
SurroundingContent = eriContext.SurroundingContent,
MatchedText = eriContext.MatchedContent ?? string.Empty,
DataSourceName = eriContext.Name ?? string.Empty,
SurroundingContent = eriContext.SurroundingContent ?? [],
});
break;
case ContentType.IMAGE:
genericRetrievalContexts.Add(new RetrievalImageContext
{
Path = eriContext.Path ?? string.Empty,
Type = eriContext.ToRetrievalContentType(),
Links = eriContext.Links,
Source = eriContext.MatchedContent,
Links = eriContext.Links ?? [],
Source = eriContext.MatchedContent ?? string.Empty,
Category = eriContext.Type.ToRetrievalContentCategory(),
SourceCategory = eriContext.Category ?? string.Empty,
SourceType = ContentImageSource.BASE64,
DataSourceName = eriContext.Name,
DataSourceName = eriContext.Name ?? string.Empty,
});
break;