mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 11:59:48 +00:00
Added handling for default providers
This commit is contained in:
parent
b10a3978c7
commit
947b1f217a
@ -30,6 +30,17 @@ public sealed class DataSourceService
|
|||||||
/// <returns>The allowed data sources and the data sources selected before -- when they are still allowed.</returns>
|
/// <returns>The allowed data sources and the data sources selected before -- when they are still allowed.</returns>
|
||||||
public async Task<AllowedSelectedDataSources> GetDataSources(AIStudio.Settings.Provider selectedLLMProvider, IReadOnlyCollection<IDataSource>? previousSelectedDataSources = null)
|
public async Task<AllowedSelectedDataSources> GetDataSources(AIStudio.Settings.Provider selectedLLMProvider, IReadOnlyCollection<IDataSource>? previousSelectedDataSources = null)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Case: Somehow the selected LLM provider was not set. The default provider
|
||||||
|
// does not mean anything. We cannot filter the data sources by any means.
|
||||||
|
// We return an empty list. Better safe than sorry.
|
||||||
|
//
|
||||||
|
if (selectedLLMProvider == default)
|
||||||
|
{
|
||||||
|
this.logger.LogWarning("The selected LLM provider is not set. We cannot filter the data sources by any means.");
|
||||||
|
return new([], []);
|
||||||
|
}
|
||||||
|
|
||||||
var allDataSources = this.settingsManager.ConfigurationData.DataSources;
|
var allDataSources = this.settingsManager.ConfigurationData.DataSources;
|
||||||
var filteredDataSources = new List<IDataSource>(allDataSources.Count);
|
var filteredDataSources = new List<IDataSource>(allDataSources.Count);
|
||||||
var filteredSelectedDataSources = new List<IDataSource>(previousSelectedDataSources?.Count ?? 0);
|
var filteredSelectedDataSources = new List<IDataSource>(previousSelectedDataSources?.Count ?? 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user