mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-14 01:13:48 +00:00
Added preview feature configuration (#227)
This commit is contained in:
1 parent
e2859b3d76
commit
55d7895f58
26 files changed
+270
-41
No files matched your search
@@ -32,6 +32,11 @@ public sealed class DataApp
|
||||
/// The visibility setting for previews features.
|
||||
/// </summary>
|
||||
public PreviewVisibility PreviewVisibility { get; set; } = PreviewVisibility.NONE;
|
||||
|
||||
/// <summary>
|
||||
/// The enabled preview features.
|
||||
/// </summary>
|
||||
public HashSet<PreviewFeatures> EnabledPreviewFeatures { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Should we preselect a provider for the entire app?
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class PreviewFeatureExtensions
|
||||
{
|
||||
public static string GetPreviewDescription(this PreviewFeatures feature) => feature switch
|
||||
{
|
||||
PreviewFeatures.PRE_WRITER_MODE_2024 => "Writer Mode: Experiments about how to write long texts using AI",
|
||||
PreviewFeatures.PRE_RAG_2024 => "RAG: Preview of our RAG implementation where you can refer your files or integrate enterprise data within your company",
|
||||
|
||||
_ => "Unknown preview feature"
|
||||
};
|
||||
|
||||
public static bool IsEnabled(this PreviewFeatures feature, SettingsManager settingsManager) => settingsManager.ConfigurationData.App.EnabledPreviewFeatures.Contains(feature);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public enum PreviewFeatures
|
||||
{
|
||||
//
|
||||
// Important: Never delete any enum value from this list.
|
||||
// We must be able to deserialize old settings files that may contain these values.
|
||||
//
|
||||
PRE_WRITER_MODE_2024,
|
||||
PRE_RAG_2024,
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class PreviewVisibilityExtensions
|
||||
{
|
||||
public static IList<PreviewFeatures> GetPreviewFeatures(this PreviewVisibility visibility)
|
||||
{
|
||||
var features = new List<PreviewFeatures>();
|
||||
if (visibility >= PreviewVisibility.RELEASE_CANDIDATE)
|
||||
{
|
||||
}
|
||||
|
||||
if (visibility >= PreviewVisibility.BETA)
|
||||
{
|
||||
}
|
||||
|
||||
if (visibility >= PreviewVisibility.ALPHA)
|
||||
{
|
||||
}
|
||||
|
||||
if (visibility >= PreviewVisibility.PROTOTYPE)
|
||||
{
|
||||
features.Add(PreviewFeatures.PRE_RAG_2024);
|
||||
}
|
||||
|
||||
if (visibility >= PreviewVisibility.EXPERIMENTAL)
|
||||
{
|
||||
features.Add(PreviewFeatures.PRE_WRITER_MODE_2024);
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
public static HashSet<PreviewFeatures> FilterPreviewFeatures(this PreviewVisibility visibility, HashSet<PreviewFeatures> enabledFeatures)
|
||||
{
|
||||
var filteredFeatures = new HashSet<PreviewFeatures>();
|
||||
var previewFeatures = visibility.GetPreviewFeatures();
|
||||
foreach (var feature in enabledFeatures)
|
||||
{
|
||||
if (previewFeatures.Contains(feature))
|
||||
filteredFeatures.Add(feature);
|
||||
}
|
||||
|
||||
return filteredFeatures;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user