Implemented the final data source filter step just before eventually the RAG process starts

This commit is contained in:
Thorsten Sommer 2025-02-14 13:01:40 +01:00
parent 5ee7f2f2f1
commit 762b4ba628
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -2,6 +2,7 @@ using System.Text.Json.Serialization;
using AIStudio.Provider; using AIStudio.Provider;
using AIStudio.Settings; using AIStudio.Settings;
using AIStudio.Tools.Services;
namespace AIStudio.Chat; namespace AIStudio.Chat;
@ -43,14 +44,34 @@ public sealed class ContentText : IContent
// //
// Check if the user wants to bind any data sources to the chat: // Check if the user wants to bind any data sources to the chat:
// //
if (chatThread.UseDataSources)
{
//
// When the user wants to bind data sources to the chat, we
// have to check if the data sources are available for the
// selected provider. Also, we have to check if any ERI
// data sources changed its security requirements.
//
List<IDataSource> preselectedDataSources = chatThread.DataSourceOptions.PreselectedDataSourceIds.Select(id => settings.ConfigurationData.DataSources.FirstOrDefault(ds => ds.Id == id)).Where(ds => ds is not null).ToList()!;
var dataSources = await dataSourceService.GetDataSources(provider, preselectedDataSources);
var selectedDataSources = dataSources.SelectedDataSources;
// //
// Trigger the retrieval part of the (R)AG process: // Should the AI select the data sources?
// //
if (chatThread.DataSourceOptions.AutomaticDataSourceSelection)
{
// TODO: Start agent based on allowed data sources.
}
// //
// Perform the augmentation of the R(A)G process: // Trigger the retrieval part of the (R)AG process:
// //
//
// Perform the augmentation of the R(A)G process:
//
}
// Store the last time we got a response. We use this later // Store the last time we got a response. We use this later
// to determine whether we should notify the UI about the // to determine whether we should notify the UI about the