mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 15:39:46 +00:00
Store the AI-selected data sources to the chat thread so that the user can see the selection
This commit is contained in:
parent
171a83ba58
commit
906219dd25
@ -154,6 +154,9 @@ public sealed class ContentText : IContent
|
|||||||
// Transform the selected data sources to the actual data sources.
|
// Transform the selected data sources to the actual data sources.
|
||||||
selectedDataSources = aiSelectedDataSources.Select(x => settings.ConfigurationData.DataSources.FirstOrDefault(ds => ds.Id == x.Id)).Where(ds => ds is not null).ToList()!;
|
selectedDataSources = aiSelectedDataSources.Select(x => settings.ConfigurationData.DataSources.FirstOrDefault(ds => ds.Id == x.Id)).Where(ds => ds is not null).ToList()!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the changes in the chat thread:
|
||||||
|
chatThread.DataSourceOptions.PreselectedDataSourceIds = selectedDataSources.Select(ds => ds.Id).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -481,6 +481,14 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
// Disable the stream state:
|
// Disable the stream state:
|
||||||
this.isStreaming = false;
|
this.isStreaming = false;
|
||||||
|
|
||||||
|
// Update the data source options. This is useful when
|
||||||
|
// the AI is responsible for selecting the data source.
|
||||||
|
// The user can then see the selected data source:
|
||||||
|
if(this.ChatThread?.DataSourceOptions.AutomaticDataSourceSelection ?? false)
|
||||||
|
this.dataSourceSelectionComponent?.ChangeOptionWithoutSaving(this.ChatThread!.DataSourceOptions);
|
||||||
|
|
||||||
|
// Update the UI:
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user