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

@@ -3,6 +3,7 @@ using System.Text.Json.Nodes;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Tools.PluginSystem;
using AIStudio.Tools.RAG;
using AIStudio.Tools.Security;
using AIStudio.Tools.Web;
@@ -579,6 +580,7 @@ public sealed class WebSearchTool(IEnumerable<IWebSearchBackend> backends, WebPa
var resultArray = new JsonArray();
var sources = new List<Source>();
var passages = new List<SourcePassage>();
for (var resultIndex = 0; resultIndex < retrievalResult.Results.Count; resultIndex++)
{
var result = retrievalResult.Results[resultIndex];
@@ -595,7 +597,11 @@ public sealed class WebSearchTool(IEnumerable<IWebSearchBackend> backends, WebPa
var finalUrl = result.CitationUrl.ToString();
var title = SearchCandidate.FirstNonEmpty(sanitizedContent.Title, finalUrl);
sources.Add(new Source(title, finalUrl, SourceOrigin.TOOL));
var source = new Source(title, finalUrl, SourceOrigin.TOOL);
sources.Add(source);
// What the model read of the page, so the user can read it under its source:
passages.Add(source.ToWebPagePassage(sanitizedContent.Markdown));
}
var retrievedPageCount = retrievalResult.Results.Count(result => result.HasPageContent);
@@ -665,6 +671,7 @@ public sealed class WebSearchTool(IEnumerable<IWebSearchBackend> backends, WebPa
{
JsonContent = resultObject,
Sources = sources,
Passages = passages,
};
}