mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 10:57:59 +00:00
Gate the RAG background work behind the preview feature flag
This commit is contained in:
3 files changed
+35
-1
No files matched your search
@@ -35,7 +35,13 @@ public sealed class AISrcSelWithRetCtxVal : IRagProcess
|
||||
//
|
||||
// 1. Check if the user wants to bind any data sources to the chat:
|
||||
//
|
||||
if (chatThread.DataSourceOptions.IsEnabled())
|
||||
//
|
||||
// Data sources are a preview feature. The check belongs here rather than in the options
|
||||
// themselves: a chat keeps its data source options while the feature is switched off, and
|
||||
// organizations may preselect data sources through a configuration plugin. Without this,
|
||||
// such a chat would still run the entire RAG process with the feature disabled.
|
||||
//
|
||||
if (PreviewFeatures.PRE_RAG_2024.IsEnabled(settings) && chatThread.DataSourceOptions.IsEnabled())
|
||||
{
|
||||
LOGGER.LogInformation("Data sources are enabled for this chat.");
|
||||
|
||||
|
||||
@@ -1057,6 +1057,19 @@ public sealed partial class DataSourceEmbeddingService(
|
||||
|
||||
private bool IsSupportedInternalDataSource(IDataSource dataSource)
|
||||
{
|
||||
//
|
||||
// Local RAG is a preview feature, so nothing here may run while it is switched off. This is
|
||||
// the one place to decide that: every path which scans files, starts a watcher, creates the
|
||||
// index database or sends text to an embedding provider asks this question first.
|
||||
//
|
||||
// Checking the feature instead of relying on "no data sources configured" also covers the
|
||||
// case where somebody enabled the feature, configured local data sources, and switched the
|
||||
// feature off again. Their data sources stay in the settings, and without this check the
|
||||
// service would keep indexing them.
|
||||
//
|
||||
if (!PreviewFeatures.PRE_RAG_2024.IsEnabled(settingsManager))
|
||||
return false;
|
||||
|
||||
return dataSource is DataSourceLocalDirectory or DataSourceLocalFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user