Merge branch 'main' into chunk-data

This commit is contained in:
Paul Koudelka committed 2026-07-01 09:54:12 +02:00
commit 2e06af13e0
133 files changed
+3704 -968

No files matched your search

@@ -11,7 +11,7 @@ public sealed class Data
/// The version of the settings file. Allows us to upgrade the settings
/// when a new version is available.
/// </summary>
public Version Version { get; init; } = Version.V5;
public Version Version { get; init; } = Version.V6;
/// <summary>
/// List of configured providers.
@@ -19,9 +19,14 @@ public sealed class Data
public List<Provider> Providers { get; init; } = [];
/// <summary>
/// Settings concerning the LLM providers.
/// Settings concerning confidence levels.
/// </summary>
public DataLLMProviders LLMProviders { get; init; } = new();
public DataConfidence Confidence { get; init; } = new(x => x.Confidence);
/// <summary>
/// Settings concerning data source security checks.
/// </summary>
public DataSourceSecuritySettings DataSourceSecurity { get; init; } = new(x => x.DataSourceSecurity);
/// <summary>
/// A collection of embedding providers configured.
@@ -100,7 +105,7 @@ public sealed class Data
public DataApp App { get; init; } = new(x => x.App);
public DataChat Chat { get; init; } = new();
public DataChat Chat { get; init; } = new(x => x.Chat);
public DataWorkspace Workspace { get; init; } = new();
@@ -57,6 +57,11 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
/// </summary>
public StartPage StartPage { get; set; } = ManagedConfiguration.Register(configSelection, n => n.StartPage, StartPage.HOME);
/// <summary>
/// Should the built-in introduction be visible on the home page?
/// </summary>
public bool ShowIntroduction { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ShowIntroduction, true);
/// <summary>
/// Should the quick start guide be visible on the home page?
/// </summary>
@@ -1,7 +1,16 @@
using System.Linq.Expressions;
namespace AIStudio.Settings.DataModel;
public sealed class DataChat
public sealed class DataChat(Expression<Func<Data, DataChat>>? configSelection = null)
{
/// <summary>
/// The default constructor for the JSON deserializer.
/// </summary>
public DataChat() : this(null)
{
}
/// <summary>
/// Shortcuts to send the input to the AI.
/// </summary>
@@ -25,22 +34,22 @@ public sealed class DataChat
/// <summary>
/// Preselect any chat options?
/// </summary>
public bool PreselectOptions { get; set; }
public bool PreselectOptions { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectOptions, false);
/// <summary>
/// Should we preselect a provider for the chat?
/// </summary>
public string PreselectedProvider { get; set; } = string.Empty;
public string PreselectedProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProvider, string.Empty);
/// <summary>
/// Preselect a profile?
/// </summary>
public string PreselectedProfile { get; set; } = string.Empty;
public string PreselectedProfile { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedProfile, string.Empty);
/// <summary>
/// Preselect a chat template?
/// </summary>
public string PreselectedChatTemplate { get; set; } = string.Empty;
public string PreselectedChatTemplate { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedChatTemplate, string.Empty);
/// <summary>
/// Should we preselect data sources options for a created chat?
@@ -0,0 +1,40 @@
using System.Linq.Expressions;
using AIStudio.Provider;
namespace AIStudio.Settings.DataModel;
public sealed class DataConfidence(Expression<Func<Data, DataConfidence>>? configSelection = null)
{
/// <summary>
/// The default constructor for the JSON deserializer.
/// </summary>
public DataConfidence() : this(null)
{
}
/// <summary>
/// Should we enforce a global minimum confidence level?
/// </summary>
public bool EnforceGlobalMinimumConfidence { get; set; } = ManagedConfiguration.Register(configSelection, n => n.EnforceGlobalMinimumConfidence, false);
/// <summary>
/// The global minimum confidence level to enforce.
/// </summary>
public ConfidenceLevel GlobalMinimumConfidence { get; set; } = ManagedConfiguration.Register(configSelection, n => n.GlobalMinimumConfidence, ConfidenceLevel.NONE);
/// <summary>
/// Should we show the provider confidence level?
/// </summary>
public bool ShowProviderConfidence { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ShowProviderConfidence, true);
/// <summary>
/// Which confidence scheme to use.
/// </summary>
public ConfidenceSchemes ConfidenceScheme { get; set; } = ManagedConfiguration.Register(configSelection, n => n.ConfidenceScheme, ConfidenceSchemes.TRUST_ALL);
/// <summary>
/// Provide custom confidence levels for each provider family.
/// </summary>
public Dictionary<LLMProviders, ConfidenceLevel> CustomConfidenceScheme { get; set; } = ManagedConfiguration.Register(configSelection, n => n.CustomConfidenceScheme, []);
}
@@ -0,0 +1,87 @@
using AIStudio.Tools.PluginSystem;
using Lua;
namespace AIStudio.Settings.DataModel;
public sealed record DataIntroduction : ILivePluginContent
{
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataIntroduction>();
/// <summary>
/// The stable ID of the introduction.
/// </summary>
public string Id { get; private init; } = string.Empty;
/// <summary>
/// The ID of the enterprise configuration plugin that provides this introduction.
/// </summary>
public Guid EnterpriseConfigurationPluginId { get; private init; } = Guid.Empty;
/// <summary>
/// The title shown to the user.
/// </summary>
public string Title { get; private init; } = string.Empty;
/// <summary>
/// The configured version string shown to the user.
/// </summary>
public string VersionText { get; private init; } = string.Empty;
/// <summary>
/// The sort index used on the home page.
/// </summary>
public int Index { get; private init; } = 1;
/// <summary>
/// The Markdown content shown to the user.
/// </summary>
public string Markdown { get; private init; } = string.Empty;
public static bool TryParseConfiguration(int idx, LuaTable table, Guid configPluginId, out DataIntroduction introduction)
{
introduction = new DataIntroduction();
if (!table.TryGetValue("Id", out var idValue) || !idValue.TryRead<string>(out var idText) || !Guid.TryParse(idText, out var id))
{
LOG.LogWarning("The configured introduction {IntroductionIndex} does not contain a valid ID. The ID must be a valid GUID.", idx);
return false;
}
if (!table.TryGetValue("Title", out var titleValue) || !titleValue.TryRead<string>(out var title) || string.IsNullOrWhiteSpace(title))
{
LOG.LogWarning("The configured introduction {IntroductionIndex} does not contain a valid Title field.", idx);
return false;
}
if (!table.TryGetValue("Version", out var versionValue) || !versionValue.TryRead<string>(out var versionText) || string.IsNullOrWhiteSpace(versionText))
{
LOG.LogWarning("The configured introduction {IntroductionIndex} does not contain a valid Version field.", idx);
return false;
}
if (!table.TryGetValue("Markdown", out var markdownValue) || !markdownValue.TryRead<string>(out var markdown) || string.IsNullOrWhiteSpace(markdown))
{
LOG.LogWarning("The configured introduction {IntroductionIndex} does not contain a valid Markdown field.", idx);
return false;
}
var index = 1;
if (table.TryGetValue("Index", out var indexValue) && !indexValue.TryRead(out index))
{
LOG.LogWarning("The configured introduction {IntroductionIndex} does not contain a valid Index field. The Index must be an integer.", idx);
return false;
}
introduction = new DataIntroduction
{
Id = id.ToString(),
Title = title,
VersionText = versionText,
Index = index,
Markdown = AIStudio.Tools.Markdown.RemoveSharedIndentation(markdown),
EnterpriseConfigurationPluginId = configPluginId,
};
return true;
}
}
@@ -1,11 +1,13 @@
using System.Security.Cryptography;
using System.Text;
using AIStudio.Tools.PluginSystem;
using Lua;
namespace AIStudio.Settings.DataModel;
public sealed record DataMandatoryInfo
public sealed record DataMandatoryInfo : ILivePluginContent
{
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataMandatoryInfo>();
@@ -1,8 +1,8 @@
using AIStudio.Provider;
namespace AIStudio.Settings.DataModel;
namespace AIStudio.Settings.DataModel.PreviousModels;
public sealed class DataLLMProviders
public sealed class DataLLMProvidersV5
{
/// <summary>
/// Should we enforce a global minimum confidence level?
@@ -25,7 +25,7 @@ public sealed class DataLLMProviders
public ConfidenceSchemes ConfidenceScheme { get; set; } = ConfidenceSchemes.TRUST_ALL;
/// <summary>
/// Provide custom confidence levels for each LLM provider.
/// Provide custom confidence levels for each provider family.
/// </summary>
public Dictionary<LLMProviders, ConfidenceLevel> CustomConfidenceScheme { get; set; } = new();
}
@@ -16,7 +16,7 @@ public sealed class DataV4
/// <summary>
/// Settings concerning the LLM providers.
/// </summary>
public DataLLMProviders LLMProviders { get; init; } = new();
public DataLLMProvidersV5 LLMProviders { get; init; } = new();
/// <summary>
/// List of configured profiles.
@@ -0,0 +1,149 @@
using AIStudio.Tools.PluginSystem.Assistants;
namespace AIStudio.Settings.DataModel.PreviousModels;
public sealed class DataV5
{
/// <summary>
/// The version of the settings file. Allows us to upgrade the settings
/// when a new version is available.
/// </summary>
public Version Version { get; init; } = Version.V5;
/// <summary>
/// List of configured providers.
/// </summary>
public List<AIStudio.Settings.Provider> Providers { get; init; } = [];
/// <summary>
/// Settings concerning the LLM providers.
/// </summary>
public DataLLMProvidersV5 LLMProviders { get; init; } = new();
/// <summary>
/// A collection of embedding providers configured.
/// </summary>
public List<EmbeddingProvider> EmbeddingProviders { get; init; } = [];
/// <summary>
/// A collection of speech providers configured.
/// </summary>
public List<TranscriptionProvider> TranscriptionProviders { get; init; } = [];
/// <summary>
/// A collection of data sources configured.
/// </summary>
public List<IDataSource> DataSources { get; set; } = [];
/// <summary>
/// List of configured profiles.
/// </summary>
public List<Profile> Profiles { get; init; } = [];
/// <summary>
/// List of configured chat templates.
/// </summary>
public List<ChatTemplate> ChatTemplates { get; init; } = [];
/// <summary>
/// List of enabled plugins.
/// </summary>
public List<Guid> EnabledPlugins { get; set; } = [];
/// <summary>
/// Metadata for managed settings that use a plugin-provided editable default.
/// </summary>
public Dictionary<string, ManagedEditableDefaultState> ManagedEditableDefaults { get; set; } = [];
/// <summary>
/// Cached audit results for assistant plugins.
/// </summary>
public List<PluginAssistantAudit> AssistantPluginAudits { get; set; } = [];
/// <summary>
/// The next provider number to use.
/// </summary>
public uint NextProviderNum { get; set; } = 1;
/// <summary>
/// The next embedding provider number to use.
/// </summary>
public uint NextEmbeddingNum { get; set; } = 1;
/// <summary>
/// The next transcription provider number to use.
/// </summary>
public uint NextTranscriptionNum { get; set; } = 1;
/// <summary>
/// The next data source number to use.
/// </summary>
public uint NextDataSourceNum { get; set; } = 1;
/// <summary>
/// The next profile number to use.
/// </summary>
public uint NextProfileNum { get; set; } = 1;
/// <summary>
/// The next chat template number to use.
/// </summary>
public uint NextChatTemplateNum { get; set; } = 1;
/// <summary>
/// The next document analysis policy number to use.
/// </summary>
public uint NextDocumentAnalysisPolicyNum { get; set; } = 1;
public DataApp App { get; init; } = new(x => x.App);
public DataChat Chat { get; init; } = new();
public DataWorkspace Workspace { get; init; } = new();
public DataIconFinder IconFinder { get; init; } = new();
public DataTranslation Translation { get; init; } = new();
public DataCoding Coding { get; init; } = new();
public DataERI ERI { get; init; } = new();
public DataDocumentAnalysis DocumentAnalysis { get; init; } = new();
public DataMandatoryInformation MandatoryInformation { get; init; } = new();
public DataTextSummarizer TextSummarizer { get; init; } = new();
public DataTextContentCleaner TextContentCleaner { get; init; } = new();
public DataAgentDataSourceSelection AgentDataSourceSelection { get; init; } = new();
public DataAgentRetrievalContextValidation AgentRetrievalContextValidation { get; init; } = new();
public DataAssistantPluginAudit AssistantPluginAudit { get; init; } = new(x => x.AssistantPluginAudit);
public DataAgenda Agenda { get; init; } = new();
public DataGrammarSpelling GrammarSpelling { get; init; } = new();
public DataRewriteImprove RewriteImprove { get; init; } = new();
public DataPromptOptimizer PromptOptimizer { get; init; } = new();
public DataEMail EMail { get; init; } = new();
public DataSlideBuilder SlideBuilder { get; init; } = new();
public DataLegalCheck LegalCheck { get; init; } = new();
public DataSynonyms Synonyms { get; init; } = new();
public DataMyTasks MyTasks { get; init; } = new();
public DataJobPostings JobPostings { get; init; } = new();
public DataBiasOfTheDay BiasOfTheDay { get; init; } = new();
public DataI18N I18N { get; init; } = new();
}