mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-27 00:53:37 +00:00
Keep preselected data sources the filters removed
This commit is contained in:
parent
44b2031749
commit
3e1e66e2d3
@ -258,7 +258,16 @@ public partial class DataSourceSelection : MSGComponentBase
|
||||
private async Task SelectionChanged(IReadOnlyCollection<IDataSource>? chosenDataSources)
|
||||
{
|
||||
this.selectedDataSources = chosenDataSources ?? [];
|
||||
this.DataSourceOptions.PreselectedDataSourceIds = this.selectedDataSources.Select(ds => ds.Id).ToList();
|
||||
|
||||
//
|
||||
// The list offers only the data sources which survived the filters, so what the user picks
|
||||
// there says nothing about the preselected ones it could not show. Those are kept: dropping
|
||||
// them would undo a choice the user never revisited, and it is these ids -- not this list --
|
||||
// which the RAG process reads when an answer is created. The query has to run before the
|
||||
// assignment, because it reads what we are about to replace.
|
||||
//
|
||||
var keptDataSourceIds = this.GetUnavailablePreselectedDataSources().Select(ds => ds.Id).ToList();
|
||||
this.DataSourceOptions.PreselectedDataSourceIds = [..keptDataSourceIds, ..this.selectedDataSources.Select(ds => ds.Id)];
|
||||
|
||||
await this.OptionsChanged();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user