mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 05:07:22 +00:00
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:
1 parent
e0d8e18f34
commit
cbc4ce5413
229 files changed
+12739
-1269
No files matched your search
+8
-1
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user