2024-08-21 06:30:01 +00:00
using AIStudio.Assistants.Agenda ;
using AIStudio.Assistants.Coding ;
using AIStudio.Assistants.IconFinder ;
using AIStudio.Assistants.RewriteImprove ;
using AIStudio.Assistants.TextSummarizer ;
2024-08-22 13:41:35 +00:00
using AIStudio.Assistants.EMail ;
2024-09-13 21:29:19 +00:00
using AIStudio.Provider ;
2024-07-28 09:20:00 +00:00
using AIStudio.Settings.DataModel ;
2024-05-04 09:08:18 +00:00
2024-08-22 13:41:35 +00:00
using WritingStylesRewrite = AIStudio . Assistants . RewriteImprove . WritingStyles ;
using WritingStylesEMail = AIStudio . Assistants . EMail . WritingStyles ;
2024-07-28 09:20:00 +00:00
namespace AIStudio.Settings ;
2024-05-04 09:08:18 +00:00
/// <summary>
/// A data structure to map a name to a value.
/// </summary>
/// <param name="Name">The name of the value, to be displayed in the UI.</param>
/// <param name="Value">The value to be stored.</param>
/// <typeparam name="T">The type of the value to store.</typeparam>
public readonly record struct ConfigurationSelectData < T > ( string Name , T Value ) ;
/// <summary>
/// A static factory class to get the lists of selectable values.
/// </summary>
public static class ConfigurationSelectDataFactory
{
2024-11-23 12:04:02 +00:00
public static IEnumerable < ConfigurationSelectData < LoadingChatProviderBehavior > > GetLoadingChatProviderBehavior ( )
{
yield return new ( "When possible, use the LLM provider which was used for each chat in the first place" , LoadingChatProviderBehavior . USE_CHAT_PROVIDER_IF_AVAILABLE ) ;
yield return new ( "Use the latest LLM provider, which was used before; use the default chat provider initially" , LoadingChatProviderBehavior . ALWAYS_USE_LATEST_CHAT_PROVIDER ) ;
yield return new ( "Always use the default chat provider when loading chats" , LoadingChatProviderBehavior . ALWAYS_USE_DEFAULT_CHAT_PROVIDER ) ;
}
public static IEnumerable < ConfigurationSelectData < AddChatProviderBehavior > > GetAddChatProviderBehavior ( )
{
yield return new ( "Use the latest LLM provider, which was used before; use the default chat provider initially" , AddChatProviderBehavior . ADDED_CHATS_USE_LATEST_PROVIDER ) ;
yield return new ( "Always use the default chat provider for new chats" , AddChatProviderBehavior . ADDED_CHATS_USE_DEFAULT_PROVIDER ) ;
}
2024-05-04 09:08:18 +00:00
public static IEnumerable < ConfigurationSelectData < SendBehavior > > GetSendBehaviorData ( )
{
yield return new ( "No key is sending the input" , SendBehavior . NO_KEY_IS_SENDING ) ;
yield return new ( "Modifier key + enter is sending the input" , SendBehavior . MODIFER_ENTER_IS_SENDING ) ;
yield return new ( "Enter is sending the input" , SendBehavior . ENTER_IS_SENDING ) ;
}
2024-06-30 13:26:28 +00:00
public static IEnumerable < ConfigurationSelectData < UpdateBehavior > > GetUpdateBehaviorData ( )
{
yield return new ( "No automatic update checks" , UpdateBehavior . NO_CHECK ) ;
yield return new ( "Once at startup" , UpdateBehavior . ONCE_STARTUP ) ;
yield return new ( "Check every hour" , UpdateBehavior . HOURLY ) ;
yield return new ( "Check every day" , UpdateBehavior . DAILY ) ;
yield return new ( "Check every week" , UpdateBehavior . WEEKLY ) ;
}
2024-07-13 08:37:57 +00:00
public static IEnumerable < ConfigurationSelectData < WorkspaceStorageBehavior > > GetWorkspaceStorageBehaviorData ( )
{
yield return new ( "Disable workspaces" , WorkspaceStorageBehavior . DISABLE_WORKSPACES ) ;
yield return new ( "Store chats automatically" , WorkspaceStorageBehavior . STORE_CHATS_AUTOMATICALLY ) ;
yield return new ( "Store chats manually" , WorkspaceStorageBehavior . STORE_CHATS_MANUALLY ) ;
}
public static IEnumerable < ConfigurationSelectData < WorkspaceStorageTemporaryMaintenancePolicy > > GetWorkspaceStorageTemporaryMaintenancePolicyData ( )
{
yield return new ( "No automatic maintenance for temporary chats" , WorkspaceStorageTemporaryMaintenancePolicy . NO_AUTOMATIC_MAINTENANCE ) ;
yield return new ( "Delete temporary chats older than 7 days" , WorkspaceStorageTemporaryMaintenancePolicy . DELETE_OLDER_THAN_7_DAYS ) ;
yield return new ( "Delete temporary chats older than 30 days" , WorkspaceStorageTemporaryMaintenancePolicy . DELETE_OLDER_THAN_30_DAYS ) ;
yield return new ( "Delete temporary chats older than 90 days" , WorkspaceStorageTemporaryMaintenancePolicy . DELETE_OLDER_THAN_90_DAYS ) ;
yield return new ( "Delete temporary chats older than 180 days" , WorkspaceStorageTemporaryMaintenancePolicy . DELETE_OLDER_THAN_180_DAYS ) ;
yield return new ( "Delete temporary chats older than 1 year" , WorkspaceStorageTemporaryMaintenancePolicy . DELETE_OLDER_THAN_365_DAYS ) ;
}
2024-07-24 13:17:45 +00:00
2024-11-02 21:53:02 +00:00
public static IEnumerable < ConfigurationSelectData < WorkspaceDisplayBehavior > > GetWorkspaceDisplayBehaviorData ( )
{
yield return new ( "Toggle the overlay: the chat uses all the space, workspaces are temporarily shown" , WorkspaceDisplayBehavior . TOGGLE_OVERLAY ) ;
yield return new ( "Toggle the sidebar: show the workspaces next to the chat when desired" , WorkspaceDisplayBehavior . TOGGLE_SIDEBAR ) ;
yield return new ( "Sidebar is always visible: show the workspaces next to the chat all the time" , WorkspaceDisplayBehavior . SIDEBAR_ALWAYS_VISIBLE ) ;
}
2024-11-24 09:11:56 +00:00
public static IEnumerable < ConfigurationSelectData < PreviewVisibility > > GetPreviewVisibility ( )
{
yield return new ( "All preview features are hidden" , PreviewVisibility . NONE ) ;
yield return new ( "Also show features ready for release; these should be stable" , PreviewVisibility . RELEASE_CANDIDATE ) ;
yield return new ( "Also show features in beta: these are almost ready for release; expect some bugs" , PreviewVisibility . BETA ) ;
2024-12-03 14:24:40 +00:00
yield return new ( "Also show features in alpha: these are in development; expect bugs and missing features" , PreviewVisibility . ALPHA ) ;
2024-11-24 09:11:56 +00:00
yield return new ( "Show also prototype features: these are works in progress; expect bugs and missing features" , PreviewVisibility . PROTOTYPE ) ;
2024-12-03 14:24:40 +00:00
yield return new ( "Show also experimental features: these are experimental; expect bugs, missing features, many changes" , PreviewVisibility . EXPERIMENTAL ) ;
2024-11-24 09:11:56 +00:00
}
2024-11-02 21:53:02 +00:00
2024-12-03 20:02:37 +00:00
public static IEnumerable < ConfigurationSelectData < PreviewFeatures > > GetPreviewFeaturesData ( SettingsManager settingsManager )
{
foreach ( var source in settingsManager . ConfigurationData . App . PreviewVisibility . GetPreviewFeatures ( ) )
yield return new ( source . GetPreviewDescription ( ) , source ) ;
}
2024-07-24 13:17:45 +00:00
public static IEnumerable < ConfigurationSelectData < NavBehavior > > GetNavBehaviorData ( )
{
yield return new ( "Navigation expands on mouse hover" , NavBehavior . EXPAND_ON_HOVER ) ;
yield return new ( "Navigation never expands, but there are tooltips" , NavBehavior . NEVER_EXPAND_USE_TOOLTIPS ) ;
yield return new ( "Navigation never expands, no tooltips" , NavBehavior . NEVER_EXPAND_NO_TOOLTIPS ) ;
yield return new ( "Always expand navigation" , NavBehavior . ALWAYS_EXPAND ) ;
}
2024-07-28 09:20:00 +00:00
public static IEnumerable < ConfigurationSelectData < IconSources > > GetIconSourcesData ( )
{
foreach ( var source in Enum . GetValues < IconSources > ( ) )
yield return new ( source . Name ( ) , source ) ;
}
public static IEnumerable < ConfigurationSelectData < CommonLanguages > > GetCommonLanguagesData ( )
{
foreach ( var language in Enum . GetValues < CommonLanguages > ( ) )
yield return new ( language . Name ( ) , language ) ;
}
2024-08-05 19:12:52 +00:00
public static IEnumerable < ConfigurationSelectData < CommonLanguages > > GetCommonLanguagesTranslationData ( )
{
foreach ( var language in Enum . GetValues < CommonLanguages > ( ) )
if ( language is CommonLanguages . AS_IS )
yield return new ( "Not yet specified" , language ) ;
else
yield return new ( language . Name ( ) , language ) ;
}
2024-09-06 20:02:20 +00:00
public static IEnumerable < ConfigurationSelectData < CommonLanguages > > GetCommonLanguagesOptionalData ( )
{
foreach ( var language in Enum . GetValues < CommonLanguages > ( ) )
if ( language is CommonLanguages . AS_IS )
yield return new ( "Do not specify the language" , language ) ;
else
yield return new ( language . Name ( ) , language ) ;
}
2024-07-28 09:20:00 +00:00
public static IEnumerable < ConfigurationSelectData < CommonCodingLanguages > > GetCommonCodingLanguagesData ( )
{
foreach ( var language in Enum . GetValues < CommonCodingLanguages > ( ) )
yield return new ( language . Name ( ) , language ) ;
}
public static IEnumerable < ConfigurationSelectData < Complexity > > GetComplexityData ( )
{
foreach ( var complexity in Enum . GetValues < Complexity > ( ) )
yield return new ( complexity . Name ( ) , complexity ) ;
}
2024-08-05 19:12:52 +00:00
public static IEnumerable < ConfigurationSelectData < NumberParticipants > > GetNumberParticipantsData ( )
{
foreach ( var number in Enum . GetValues < NumberParticipants > ( ) )
yield return new ( number . Name ( ) , number ) ;
}
2024-08-13 18:53:09 +00:00
2024-08-22 13:41:35 +00:00
public static IEnumerable < ConfigurationSelectData < WritingStylesRewrite > > GetWritingStyles4RewriteData ( )
{
foreach ( var style in Enum . GetValues < WritingStylesRewrite > ( ) )
yield return new ( style . Name ( ) , style ) ;
}
public static IEnumerable < ConfigurationSelectData < WritingStylesEMail > > GetWritingStyles4EMailData ( )
2024-08-13 18:53:09 +00:00
{
2024-08-22 13:41:35 +00:00
foreach ( var style in Enum . GetValues < WritingStylesEMail > ( ) )
2024-08-13 18:53:09 +00:00
yield return new ( style . Name ( ) , style ) ;
}
2024-08-23 16:11:54 +00:00
public static IEnumerable < ConfigurationSelectData < SentenceStructure > > GetSentenceStructureData ( )
{
foreach ( var voice in Enum . GetValues < SentenceStructure > ( ) )
yield return new ( voice . Name ( ) , voice ) ;
}
2024-09-08 19:01:51 +00:00
public static IEnumerable < ConfigurationSelectData < string > > GetProfilesData ( IEnumerable < Profile > profiles )
{
foreach ( var profile in profiles . GetAllProfiles ( ) )
yield return new ( profile . Name , profile . Id ) ;
}
2024-09-11 21:08:02 +00:00
public static IEnumerable < ConfigurationSelectData < ConfidenceSchemes > > GetConfidenceSchemesData ( )
{
foreach ( var scheme in Enum . GetValues < ConfidenceSchemes > ( ) )
yield return new ( scheme . GetListDescription ( ) , scheme ) ;
}
2024-09-13 21:29:19 +00:00
2024-09-14 17:20:33 +00:00
public static IEnumerable < ConfigurationSelectData < ConfidenceLevel > > GetConfidenceLevelsData ( SettingsManager settingsManager , bool restrictToGlobalMinimum = false )
2024-09-13 21:29:19 +00:00
{
2024-09-14 17:20:33 +00:00
var minimumLevel = ConfidenceLevel . NONE ;
if ( restrictToGlobalMinimum & & settingsManager . ConfigurationData . LLMProviders is { EnforceGlobalMinimumConfidence : true , GlobalMinimumConfidence : not ConfidenceLevel . NONE and not ConfidenceLevel . UNKNOWN } )
minimumLevel = settingsManager . ConfigurationData . LLMProviders . GlobalMinimumConfidence ;
2024-09-13 21:29:19 +00:00
foreach ( var level in Enum . GetValues < ConfidenceLevel > ( ) )
{
2024-09-14 17:20:33 +00:00
if ( level is ConfidenceLevel . NONE )
yield return new ( "No minimum confidence level chosen" , level ) ;
if ( level < minimumLevel )
continue ;
2024-09-13 21:29:19 +00:00
switch ( level )
{
2024-09-14 17:20:33 +00:00
case ConfidenceLevel . NONE :
2024-09-13 21:29:19 +00:00
case ConfidenceLevel . UNKNOWN :
continue ;
default :
yield return new ( level . GetName ( ) , level ) ;
break ;
}
}
}
2024-09-15 10:30:07 +00:00
public static IEnumerable < ConfigurationSelectData < Themes > > GetThemesData ( )
{
foreach ( var theme in Enum . GetValues < Themes > ( ) )
yield return new ( theme . GetName ( ) , theme ) ;
}
2024-05-04 09:08:18 +00:00
}