diff --git a/app/MindWork AI Studio/Chat/ContentText.cs b/app/MindWork AI Studio/Chat/ContentText.cs index 451d0365..3679a57c 100644 --- a/app/MindWork AI Studio/Chat/ContentText.cs +++ b/app/MindWork AI Studio/Chat/ContentText.cs @@ -2,6 +2,7 @@ using System.Text.Json.Serialization; using AIStudio.Provider; using AIStudio.Settings; +using AIStudio.Tools.Services; namespace AIStudio.Chat; @@ -43,15 +44,35 @@ public sealed class ContentText : IContent // // Check if the user wants to bind any data sources to the chat: // - - // - // Trigger the retrieval part of the (R)AG process: - // - - // - // Perform the augmentation of the R(A)G process: - // - + 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 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; + + // + // Should the AI select the data sources? + // + if (chatThread.DataSourceOptions.AutomaticDataSourceSelection) + { + // TODO: Start agent based on allowed data sources. + } + + // + // 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 // to determine whether we should notify the UI about the // new content or not. Depends on the energy saving mode