Bias of the day (#173)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-10-28 15:41:00 +01:00
1 parent e9c805f0df
commit 217b9c4db3
20 files changed
+491 -35

No files matched your search

@@ -22,6 +22,16 @@ namespace AIStudio.Settings.DataModel;
/// </remarks>
public static class BiasCatalog
{
public static readonly Bias NONE = new()
{
Id = Guid.Empty,
Category = BiasCategory.NONE,
Name = "None",
Description = "No bias selected.",
Related = [],
Links = [],
};
#region WHAT_SHOULD_WE_REMEMBER
private static readonly Bias MISATTRIBUTION_OF_MEMORY = new()
@@ -5909,4 +5919,23 @@ public static class BiasCatalog
{ IMPLICIT_STEREOTYPES.Id, IMPLICIT_STEREOTYPES },
{ IMPLICIT_ASSOCIATIONS.Id, IMPLICIT_ASSOCIATIONS },
};
public static Bias GetRandomBias(IList<int> usedBias)
{
if(usedBias.Count >= ALL_BIAS.Count)
usedBias.Clear();
int randomBiasIndex;
lock (RANDOM)
{
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
while(usedBias.Contains(randomBiasIndex))
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
}
usedBias.Add(randomBiasIndex);
return ALL_BIAS.Values.ElementAt(randomBiasIndex);
}
private static readonly Random RANDOM = new();
}
@@ -67,4 +67,6 @@ public sealed class Data
public DataMyTasks MyTasks { get; init; } = new();
public DataJobPostings JobPostings { get; init; } = new();
public DataBiasOfTheDay BiasOfTheDay { get; init; } = new();
}
@@ -0,0 +1,61 @@
using AIStudio.Provider;
namespace AIStudio.Settings.DataModel;
public sealed class DataBiasOfTheDay
{
/// <summary>
/// A list of bias IDs that have been used.
/// </summary>
public List<int> UsedBias { get; set; } = new();
/// <summary>
/// When was the last bias drawn?
/// </summary>
public DateOnly DateLastBiasDrawn { get; set; } = DateOnly.MinValue;
/// <summary>
/// Which bias is the bias of the day? This isn't the bias id, but rather the chat id in the bias workspace.
/// </summary>
public Guid BiasOfTheDayChatId { get; set; } = Guid.Empty;
/// <summary>
/// Which bias is the bias of the day?
/// </summary>
public Guid BiasOfTheDayId { get; set; } = Guid.Empty;
/// <summary>
/// Restrict to one bias per day?
/// </summary>
public bool RestrictOneBiasPerDay { get; set; } = true;
/// <summary>
/// Preselect any rewrite options?
/// </summary>
public bool PreselectOptions { get; set; }
/// <summary>
/// Preselect the language?
/// </summary>
public CommonLanguages PreselectedTargetLanguage { get; set; }
/// <summary>
/// Preselect any other language?
/// </summary>
public string PreselectedOtherLanguage { get; set; } = string.Empty;
/// <summary>
/// The minimum confidence level required for a provider to be considered.
/// </summary>
public ConfidenceLevel MinimumProviderConfidence { get; set; } = ConfidenceLevel.NONE;
/// <summary>
/// Preselect a profile?
/// </summary>
public string PreselectedProfile { get; set; } = string.Empty;
/// <summary>
/// Preselect a provider?
/// </summary>
public string PreselectedProvider { get; set; } = string.Empty;
}