Added optional enforcement for a min. confidence level (#145)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-09-13 23:29:19 +02:00
1 parent 1cac1a7913
commit 4175387a93
15 files changed
+242 -16

No files matched your search

@@ -9,7 +9,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.V4;
public Version Version { get; init; } = Version.V5;
/// <summary>
/// List of configured providers.
@@ -4,6 +4,16 @@ namespace AIStudio.Settings.DataModel;
public sealed class DataLLMProviders
{
/// <summary>
/// Should we enforce a global minimum confidence level?
/// </summary>
public bool EnforceGlobalMinimumConfidence { get; set; }
/// <summary>
/// The global minimum confidence level to enforce.
/// </summary>
public ConfidenceLevel GlobalMinimumConfidence { get; set; } = ConfidenceLevel.NONE;
/// <summary>
/// Should we show the provider confidence level?
/// </summary>
@@ -0,0 +1,65 @@
namespace AIStudio.Settings.DataModel.PreviousModels;
public sealed class DataV4
{
/// <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; }
/// <summary>
/// List of configured providers.
/// </summary>
public List<Provider> Providers { get; init; } = [];
/// <summary>
/// Settings concerning the LLM providers.
/// </summary>
public DataLLMProviders LLMProviders { get; init; } = new();
/// <summary>
/// List of configured profiles.
/// </summary>
public List<Profile> Profiles { get; init; } = [];
/// <summary>
/// The next provider number to use.
/// </summary>
public uint NextProviderNum { get; set; } = 1;
/// <summary>
/// The next profile number to use.
/// </summary>
public uint NextProfileNum { get; set; } = 1;
public DataApp App { get; init; } = new();
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 DataTextSummarizer TextSummarizer { get; init; } = new();
public DataTextContentCleaner TextContentCleaner { get; init; } = new();
public DataAgenda Agenda { get; init; } = new();
public DataGrammarSpelling GrammarSpelling { get; init; } = new();
public DataRewriteImprove RewriteImprove { get; init; } = new();
public DataEMail EMail { get; set; } = new();
public DataLegalCheck LegalCheck { get; set; } = new();
public DataSynonyms Synonyms { get; set; } = new();
public DataMyTasks MyTasks { get; set; } = new();
}
@@ -0,0 +1,15 @@
using AIStudio.Provider;
using Host = AIStudio.Provider.SelfHosted.Host;
namespace AIStudio.Settings.DataModel.PreviousModels;
public readonly record struct Provider(
uint Num,
string Id,
string InstanceName,
LLMProviders UsedProvider,
Model Model,
bool IsSelfHosted = false,
string Hostname = "http://localhost:1234",
Host Host = Host.NONE);
@@ -0,0 +1,21 @@
namespace AIStudio.Settings.DataModel.PreviousModels;
public static class ProviderV4Extensions
{
public static List<Settings.Provider> MigrateFromV4ToV5(this IEnumerable<Provider> providers)
{
return providers.Select(provider => provider.MigrateFromV4ToV5()).ToList();
}
public static Settings.Provider MigrateFromV4ToV5(this Provider provider) => new()
{
Num = provider.Num,
Id = provider.Id,
InstanceName = provider.InstanceName,
UsedLLMProvider = provider.UsedProvider,
Model = provider.Model,
IsSelfHosted = provider.IsSelfHosted,
Hostname = provider.Hostname,
Host = provider.Host,
};
}