mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 10:57:59 +00:00
Add agenda assistant (#69)
This commit is contained in:
1 parent
1ec86ec1a6
commit
6b7800b615
60 files changed
+1873
-582
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using AIStudio.Components.Pages.Agenda;
|
||||
using AIStudio.Components.Pages.Coding;
|
||||
using AIStudio.Components.Pages.IconFinder;
|
||||
using AIStudio.Components.Pages.TextSummarizer;
|
||||
@@ -72,6 +73,15 @@ public static class ConfigurationSelectDataFactory
|
||||
yield return new(language.Name(), language);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<CommonCodingLanguages>> GetCommonCodingLanguagesData()
|
||||
{
|
||||
foreach (var language in Enum.GetValues<CommonCodingLanguages>())
|
||||
@@ -83,4 +93,10 @@ public static class ConfigurationSelectDataFactory
|
||||
foreach (var complexity in Enum.GetValues<Complexity>())
|
||||
yield return new(complexity.Name(), complexity);
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<NumberParticipants>> GetNumberParticipantsData()
|
||||
{
|
||||
foreach (var number in Enum.GetValues<NumberParticipants>())
|
||||
yield return new(number.Name(), number);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,3 @@
|
||||
using AIStudio.Components.Pages.Coding;
|
||||
using AIStudio.Components.Pages.IconFinder;
|
||||
using AIStudio.Components.Pages.TextSummarizer;
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
/// <summary>
|
||||
@@ -14,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.V3;
|
||||
public Version Version { get; init; } = Version.V4;
|
||||
|
||||
/// <summary>
|
||||
/// List of configured providers.
|
||||
@@ -26,222 +21,21 @@ public sealed class Data
|
||||
/// </summary>
|
||||
public uint NextProviderNum { get; set; } = 1;
|
||||
|
||||
#region App Settings
|
||||
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();
|
||||
|
||||
/// <summary>
|
||||
/// Should we save energy? When true, we will update content streamed
|
||||
/// from the server, i.e., AI, less frequently.
|
||||
/// </summary>
|
||||
public bool IsSavingEnergy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we enable spellchecking for all input fields?
|
||||
/// </summary>
|
||||
public bool EnableSpellchecking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If and when we should look for updates.
|
||||
/// </summary>
|
||||
public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP;
|
||||
|
||||
/// <summary>
|
||||
/// The navigation behavior.
|
||||
/// </summary>
|
||||
public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Chat Settings
|
||||
|
||||
/// <summary>
|
||||
/// Shortcuts to send the input to the AI.
|
||||
/// </summary>
|
||||
public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any chat options?
|
||||
/// </summary>
|
||||
public bool PreselectChatOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we preselect a provider for the chat?
|
||||
/// </summary>
|
||||
public string PreselectedChatProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workspace Settings
|
||||
|
||||
/// <summary>
|
||||
/// The chat storage behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageBehavior WorkspaceStorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY;
|
||||
|
||||
/// <summary>
|
||||
/// The chat storage maintenance behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageTemporaryMaintenancePolicy WorkspaceStorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assiatant: Icon Finder Settings
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to preselect any icon options?
|
||||
/// </summary>
|
||||
public bool PreselectIconOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon source.
|
||||
/// </summary>
|
||||
public IconSources PreselectedIconSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon provider.
|
||||
/// </summary>
|
||||
public string PreselectedIconProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Translation Settings
|
||||
|
||||
/// <summary>
|
||||
/// The live translation interval for debouncing in milliseconds.
|
||||
/// </summary>
|
||||
public int LiveTranslationDebounceIntervalMilliseconds { get; set; } = 1_500;
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to preselect any translator options?
|
||||
/// </summary>
|
||||
public bool PreselectTranslationOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the live translation?
|
||||
/// </summary>
|
||||
public bool PreselectLiveTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReaderForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReaderForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgentForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTranslationTargetLanguage { get; set; } = CommonLanguages.EN_US;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectTranslationOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The preselected translator provider.
|
||||
/// </summary>
|
||||
public string PreselectedTranslationProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Coding Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any coding options?
|
||||
/// </summary>
|
||||
public bool PreselectCodingOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the compiler messages?
|
||||
/// </summary>
|
||||
public bool PreselectCodingCompilerMessages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the coding language for new contexts?
|
||||
/// </summary>
|
||||
public CommonCodingLanguages PreselectedCodingLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Do you want to preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedCodingOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Which coding provider should be preselected?
|
||||
/// </summary>
|
||||
public string PreselectedCodingProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Text Summarizer Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any text summarizer options?
|
||||
/// </summary>
|
||||
public bool PreselectTextSummarizerOptions { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReaderForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReaderForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgentForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTextSummarizerTargetLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the complexity?
|
||||
/// </summary>
|
||||
public Complexity PreselectedTextSummarizerComplexity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any expertise in a field?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerExpertInField { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text summarizer provider?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Agent: Text Content Cleaner Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any text content cleaner options?
|
||||
/// </summary>
|
||||
public bool PreselectAgentTextContentCleanerOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text content cleaner provider?
|
||||
/// </summary>
|
||||
public string PreselectedAgentTextContentCleanerProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
public DataAgenda Agenda { get; init; } = new();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using AIStudio.Components.Pages.Agenda;
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataAgenda
|
||||
{
|
||||
/// <summary>
|
||||
/// Preselect any agenda options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
public string PreselectName { get; set; } = string.Empty;
|
||||
|
||||
public string PreselectTopic { get; set; } = string.Empty;
|
||||
|
||||
public string PreselectObjective { get; set; } = string.Empty;
|
||||
|
||||
public string PreselectModerator { get; set; } = string.Empty;
|
||||
|
||||
public string PreselectDuration { get; set; } = string.Empty;
|
||||
|
||||
public string PreselectStartTime { get; set; } = string.Empty;
|
||||
|
||||
public bool PreselectIntroduceParticipants { get; set; }
|
||||
|
||||
public NumberParticipants PreselectNumberParticipants { get; set; } = NumberParticipants.NOT_SPECIFIED;
|
||||
|
||||
public bool PreselectActiveParticipation { get; set; }
|
||||
|
||||
public bool PreselectIsMeetingVirtual { get; set; } = true;
|
||||
|
||||
public string PreselectLocation { get; set; } = string.Empty;
|
||||
|
||||
public bool PreselectJointDinner { get; set; }
|
||||
|
||||
public bool PreselectSocialActivity { get; set; }
|
||||
|
||||
public bool PreselectArriveAndDepart { get; set; }
|
||||
|
||||
public int PreselectLunchTime { get; set; }
|
||||
|
||||
public int PreselectBreakTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTargetLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a agenda provider?
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataApp
|
||||
{
|
||||
/// <summary>
|
||||
/// Should we save energy? When true, we will update content streamed
|
||||
/// from the server, i.e., AI, less frequently.
|
||||
/// </summary>
|
||||
public bool IsSavingEnergy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we enable spellchecking for all input fields?
|
||||
/// </summary>
|
||||
public bool EnableSpellchecking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If and when we should look for updates.
|
||||
/// </summary>
|
||||
public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP;
|
||||
|
||||
/// <summary>
|
||||
/// The navigation behavior.
|
||||
/// </summary>
|
||||
public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataChat
|
||||
{
|
||||
/// <summary>
|
||||
/// Shortcuts to send the input to the AI.
|
||||
/// </summary>
|
||||
public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any chat options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we preselect a provider for the chat?
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using AIStudio.Components.Pages.Coding;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataCoding
|
||||
{
|
||||
/// <summary>
|
||||
/// Preselect any coding options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the compiler messages?
|
||||
/// </summary>
|
||||
public bool PreselectCompilerMessages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the coding language for new contexts?
|
||||
/// </summary>
|
||||
public CommonCodingLanguages PreselectedProgrammingLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Do you want to preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedOtherProgrammingLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Which coding provider should be preselected?
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using AIStudio.Components.Pages.IconFinder;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataIconFinder
|
||||
{
|
||||
/// <summary>
|
||||
/// Do we want to preselect any icon options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon source.
|
||||
/// </summary>
|
||||
public IconSources PreselectedSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon provider.
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataTextContentCleaner
|
||||
{
|
||||
/// <summary>
|
||||
/// Preselect any text content cleaner options?
|
||||
/// </summary>
|
||||
public bool PreselectAgentOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text content cleaner provider?
|
||||
/// </summary>
|
||||
public string PreselectedAgentProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using AIStudio.Components.Pages.TextSummarizer;
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataTextSummarizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Preselect any text summarizer options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTargetLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the complexity?
|
||||
/// </summary>
|
||||
public Complexity PreselectedComplexity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any expertise in a field?
|
||||
/// </summary>
|
||||
public string PreselectedExpertInField { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text summarizer provider?
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataTranslation
|
||||
{
|
||||
/// <summary>
|
||||
/// The live translation interval for debouncing in milliseconds.
|
||||
/// </summary>
|
||||
public int DebounceIntervalMilliseconds { get; set; } = 1_500;
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to preselect any translator options?
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the live translation?
|
||||
/// </summary>
|
||||
public bool PreselectLiveTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTargetLanguage { get; set; } = CommonLanguages.EN_US;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The preselected translator provider.
|
||||
/// </summary>
|
||||
public string PreselectedProvider { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataWorkspace
|
||||
{
|
||||
/// <summary>
|
||||
/// The chat storage behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageBehavior StorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY;
|
||||
|
||||
/// <summary>
|
||||
/// The chat storage maintenance behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageTemporaryMaintenancePolicy StorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS;
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
using AIStudio.Components.Pages.Coding;
|
||||
using AIStudio.Components.Pages.IconFinder;
|
||||
using AIStudio.Components.Pages.TextSummarizer;
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Settings.DataModel.PreviousModels;
|
||||
|
||||
/// <summary>
|
||||
/// The data model for the settings file.
|
||||
/// </summary>
|
||||
public sealed class DataV1V3
|
||||
{
|
||||
/// <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.V3;
|
||||
|
||||
/// <summary>
|
||||
/// List of configured providers.
|
||||
/// </summary>
|
||||
public List<Provider> Providers { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The next provider number to use.
|
||||
/// </summary>
|
||||
public uint NextProviderNum { get; set; } = 1;
|
||||
|
||||
#region App Settings
|
||||
|
||||
/// <summary>
|
||||
/// Should we save energy? When true, we will update content streamed
|
||||
/// from the server, i.e., AI, less frequently.
|
||||
/// </summary>
|
||||
public bool IsSavingEnergy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we enable spellchecking for all input fields?
|
||||
/// </summary>
|
||||
public bool EnableSpellchecking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If and when we should look for updates.
|
||||
/// </summary>
|
||||
public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP;
|
||||
|
||||
/// <summary>
|
||||
/// The navigation behavior.
|
||||
/// </summary>
|
||||
public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Chat Settings
|
||||
|
||||
/// <summary>
|
||||
/// Shortcuts to send the input to the AI.
|
||||
/// </summary>
|
||||
public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any chat options?
|
||||
/// </summary>
|
||||
public bool PreselectChatOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should we preselect a provider for the chat?
|
||||
/// </summary>
|
||||
public string PreselectedChatProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workspace Settings
|
||||
|
||||
/// <summary>
|
||||
/// The chat storage behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageBehavior WorkspaceStorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY;
|
||||
|
||||
/// <summary>
|
||||
/// The chat storage maintenance behavior.
|
||||
/// </summary>
|
||||
public WorkspaceStorageTemporaryMaintenancePolicy WorkspaceStorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assiatant: Icon Finder Settings
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to preselect any icon options?
|
||||
/// </summary>
|
||||
public bool PreselectIconOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon source.
|
||||
/// </summary>
|
||||
public IconSources PreselectedIconSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The preselected icon provider.
|
||||
/// </summary>
|
||||
public string PreselectedIconProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Translation Settings
|
||||
|
||||
/// <summary>
|
||||
/// The live translation interval for debouncing in milliseconds.
|
||||
/// </summary>
|
||||
public int LiveTranslationDebounceIntervalMilliseconds { get; set; } = 1_500;
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to preselect any translator options?
|
||||
/// </summary>
|
||||
public bool PreselectTranslationOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the live translation?
|
||||
/// </summary>
|
||||
public bool PreselectLiveTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReaderForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReaderForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgentForTranslation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTranslationTargetLanguage { get; set; } = CommonLanguages.EN_US;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectTranslationOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The preselected translator provider.
|
||||
/// </summary>
|
||||
public string PreselectedTranslationProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Coding Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any coding options?
|
||||
/// </summary>
|
||||
public bool PreselectCodingOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the compiler messages?
|
||||
/// </summary>
|
||||
public bool PreselectCodingCompilerMessages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the coding language for new contexts?
|
||||
/// </summary>
|
||||
public CommonCodingLanguages PreselectedCodingLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Do you want to preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedCodingOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Which coding provider should be preselected?
|
||||
/// </summary>
|
||||
public string PreselectedCodingProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assistant: Text Summarizer Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any text summarizer options?
|
||||
/// </summary>
|
||||
public bool PreselectTextSummarizerOptions { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hide the web content reader?
|
||||
/// </summary>
|
||||
public bool HideWebContentReaderForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the web content reader?
|
||||
/// </summary>
|
||||
public bool PreselectWebContentReaderForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the content cleaner agent?
|
||||
/// </summary>
|
||||
public bool PreselectContentCleanerAgentForTextSummarizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the target language?
|
||||
/// </summary>
|
||||
public CommonLanguages PreselectedTextSummarizerTargetLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any other language?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerOtherLanguage { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the complexity?
|
||||
/// </summary>
|
||||
public Complexity PreselectedTextSummarizerComplexity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any expertise in a field?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerExpertInField { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text summarizer provider?
|
||||
/// </summary>
|
||||
public string PreselectedTextSummarizerProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Agent: Text Content Cleaner Settings
|
||||
|
||||
/// <summary>
|
||||
/// Preselect any text content cleaner options?
|
||||
/// </summary>
|
||||
public bool PreselectAgentTextContentCleanerOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect a text content cleaner provider?
|
||||
/// </summary>
|
||||
public string PreselectedAgentTextContentCleanerProvider { get; set; } = string.Empty;
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -107,13 +107,33 @@ public sealed class SettingsManager
|
||||
var settingsPath = Path.Combine(ConfigDirectory!, SETTINGS_FILENAME);
|
||||
if(!File.Exists(settingsPath))
|
||||
return;
|
||||
|
||||
var settingsJson = await File.ReadAllTextAsync(settingsPath);
|
||||
var loadedConfiguration = JsonSerializer.Deserialize<Data>(settingsJson, JSON_OPTIONS);
|
||||
if(loadedConfiguration is null)
|
||||
|
||||
// We read the `"Version": "V3"` line to determine the version of the settings file:
|
||||
await foreach (var line in File.ReadLinesAsync(settingsPath))
|
||||
{
|
||||
if (!line.Contains("""
|
||||
"Version":
|
||||
"""))
|
||||
continue;
|
||||
|
||||
// Extract the version from the line:
|
||||
var settingsVersionText = line.Split('"')[3];
|
||||
|
||||
// Parse the version:
|
||||
Enum.TryParse(settingsVersionText, out Version settingsVersion);
|
||||
if(settingsVersion is Version.UNKNOWN)
|
||||
{
|
||||
Console.WriteLine("Error: Unknown version of the settings file.");
|
||||
this.ConfigurationData = new();
|
||||
return;
|
||||
}
|
||||
|
||||
this.ConfigurationData = SettingsMigrations.Migrate(settingsVersion, await File.ReadAllTextAsync(settingsPath), JSON_OPTIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ConfigurationData = SettingsMigrations.Migrate(loadedConfiguration);
|
||||
Console.WriteLine("Error: Failed to read the version of the settings file.");
|
||||
this.ConfigurationData = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -132,5 +152,5 @@ public sealed class SettingsManager
|
||||
await File.WriteAllTextAsync(settingsPath, settingsJson);
|
||||
}
|
||||
|
||||
public void InjectSpellchecking(Dictionary<string, object?> attributes) => attributes["spellcheck"] = this.ConfigurationData.EnableSpellchecking ? "true" : "false";
|
||||
public void InjectSpellchecking(Dictionary<string, object?> attributes) => attributes["spellcheck"] = this.ConfigurationData.App.EnableSpellchecking ? "true" : "false";
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Text.Json;
|
||||
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Settings.DataModel.PreviousModels;
|
||||
|
||||
using Host = AIStudio.Provider.SelfHosted.Host;
|
||||
|
||||
@@ -6,24 +9,57 @@ namespace AIStudio.Settings;
|
||||
|
||||
public static class SettingsMigrations
|
||||
{
|
||||
public static Data Migrate(Data previousData)
|
||||
public static Data Migrate(Version previousVersion, string configData, JsonSerializerOptions jsonOptions)
|
||||
{
|
||||
switch (previousData.Version)
|
||||
switch (previousVersion)
|
||||
{
|
||||
case Version.V1:
|
||||
previousData = MigrateV1ToV2(previousData);
|
||||
return MigrateV2ToV3(previousData);
|
||||
var configV1 = JsonSerializer.Deserialize<DataV1V3>(configData, jsonOptions);
|
||||
if (configV1 is null)
|
||||
{
|
||||
Console.WriteLine("Error: failed to parse the configuration. Using default values.");
|
||||
return new();
|
||||
}
|
||||
|
||||
configV1 = MigrateV1ToV2(configV1);
|
||||
configV1 = MigrateV2ToV3(configV1);
|
||||
return MigrateV3ToV4(configV1);
|
||||
|
||||
case Version.V2:
|
||||
return MigrateV2ToV3(previousData);
|
||||
|
||||
var configV2 = JsonSerializer.Deserialize<DataV1V3>(configData, jsonOptions);
|
||||
if (configV2 is null)
|
||||
{
|
||||
Console.WriteLine("Error: failed to parse the configuration. Using default values.");
|
||||
return new();
|
||||
}
|
||||
|
||||
configV2 = MigrateV2ToV3(configV2);
|
||||
return MigrateV3ToV4(configV2);
|
||||
|
||||
case Version.V3:
|
||||
var configV3 = JsonSerializer.Deserialize<DataV1V3>(configData, jsonOptions);
|
||||
if (configV3 is null)
|
||||
{
|
||||
Console.WriteLine("Error: failed to parse the configuration. Using default values.");
|
||||
return new();
|
||||
}
|
||||
|
||||
return MigrateV3ToV4(configV3);
|
||||
|
||||
default:
|
||||
Console.WriteLine("No migration needed.");
|
||||
return previousData;
|
||||
Console.WriteLine("No configuration migration needed.");
|
||||
var configV4 = JsonSerializer.Deserialize<Data>(configData, jsonOptions);
|
||||
if (configV4 is null)
|
||||
{
|
||||
Console.WriteLine("Error: failed to parse the configuration. Using default values.");
|
||||
return new();
|
||||
}
|
||||
|
||||
return configV4;
|
||||
}
|
||||
}
|
||||
|
||||
private static Data MigrateV1ToV2(Data previousData)
|
||||
private static DataV1V3 MigrateV1ToV2(DataV1V3 previousData)
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
@@ -45,7 +81,7 @@ public static class SettingsMigrations
|
||||
};
|
||||
}
|
||||
|
||||
private static Data MigrateV2ToV3(Data previousData)
|
||||
private static DataV1V3 MigrateV2ToV3(DataV1V3 previousData)
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
@@ -73,4 +109,89 @@ public static class SettingsMigrations
|
||||
WorkspaceStorageTemporaryMaintenancePolicy = previousData.WorkspaceStorageTemporaryMaintenancePolicy,
|
||||
};
|
||||
}
|
||||
|
||||
private static Data MigrateV3ToV4(DataV1V3 previousConfig)
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// We grouped the settings into different categories.
|
||||
//
|
||||
|
||||
Console.WriteLine("Migrating from v3 to v4...");
|
||||
return new()
|
||||
{
|
||||
Version = Version.V4,
|
||||
Providers = previousConfig.Providers,
|
||||
NextProviderNum = previousConfig.NextProviderNum,
|
||||
|
||||
App = new()
|
||||
{
|
||||
EnableSpellchecking = previousConfig.EnableSpellchecking,
|
||||
IsSavingEnergy = previousConfig.IsSavingEnergy,
|
||||
UpdateBehavior = previousConfig.UpdateBehavior,
|
||||
NavigationBehavior = previousConfig.NavigationBehavior,
|
||||
},
|
||||
|
||||
Chat = new()
|
||||
{
|
||||
ShortcutSendBehavior = previousConfig.ShortcutSendBehavior,
|
||||
PreselectOptions = previousConfig.PreselectChatOptions,
|
||||
PreselectedProvider = previousConfig.PreselectedChatProvider,
|
||||
},
|
||||
|
||||
Workspace = new()
|
||||
{
|
||||
StorageBehavior = previousConfig.WorkspaceStorageBehavior,
|
||||
StorageTemporaryMaintenancePolicy = previousConfig.WorkspaceStorageTemporaryMaintenancePolicy,
|
||||
},
|
||||
|
||||
IconFinder = new()
|
||||
{
|
||||
PreselectOptions = previousConfig.PreselectIconOptions,
|
||||
PreselectedProvider = previousConfig.PreselectedIconProvider,
|
||||
PreselectedSource = previousConfig.PreselectedIconSource,
|
||||
},
|
||||
|
||||
Translation = new()
|
||||
{
|
||||
PreselectLiveTranslation = previousConfig.PreselectLiveTranslation,
|
||||
DebounceIntervalMilliseconds = previousConfig.LiveTranslationDebounceIntervalMilliseconds,
|
||||
PreselectOptions = previousConfig.PreselectTranslationOptions,
|
||||
PreselectedProvider = previousConfig.PreselectedTranslationProvider,
|
||||
PreselectedTargetLanguage = previousConfig.PreselectedTranslationTargetLanguage,
|
||||
PreselectOtherLanguage = previousConfig.PreselectTranslationOtherLanguage,
|
||||
HideWebContentReader = previousConfig.HideWebContentReaderForTranslation,
|
||||
PreselectContentCleanerAgent = previousConfig.PreselectContentCleanerAgentForTranslation,
|
||||
PreselectWebContentReader = previousConfig.PreselectWebContentReaderForTranslation,
|
||||
},
|
||||
|
||||
Coding = new()
|
||||
{
|
||||
PreselectOptions = previousConfig.PreselectCodingOptions,
|
||||
PreselectedProvider = previousConfig.PreselectedCodingProvider,
|
||||
PreselectedProgrammingLanguage = previousConfig.PreselectedCodingLanguage,
|
||||
PreselectedOtherProgrammingLanguage = previousConfig.PreselectedCodingOtherLanguage,
|
||||
PreselectCompilerMessages = previousConfig.PreselectCodingCompilerMessages,
|
||||
},
|
||||
|
||||
TextSummarizer = new()
|
||||
{
|
||||
PreselectOptions = previousConfig.PreselectTextSummarizerOptions,
|
||||
PreselectedComplexity = previousConfig.PreselectedTextSummarizerComplexity,
|
||||
PreselectedProvider = previousConfig.PreselectedTextSummarizerProvider,
|
||||
PreselectedTargetLanguage = previousConfig.PreselectedTextSummarizerTargetLanguage,
|
||||
PreselectedOtherLanguage = previousConfig.PreselectedTextSummarizerOtherLanguage,
|
||||
PreselectedExpertInField = previousConfig.PreselectedTextSummarizerExpertInField,
|
||||
HideWebContentReader = previousConfig.HideWebContentReaderForTextSummarizer,
|
||||
PreselectContentCleanerAgent = previousConfig.PreselectContentCleanerAgentForTextSummarizer,
|
||||
PreselectWebContentReader = previousConfig.PreselectWebContentReaderForTextSummarizer,
|
||||
},
|
||||
|
||||
TextContentCleaner = new()
|
||||
{
|
||||
PreselectAgentOptions = previousConfig.PreselectAgentTextContentCleanerOptions,
|
||||
PreselectedAgentProvider = previousConfig.PreselectedAgentTextContentCleanerProvider,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,5 @@ public enum Version
|
||||
V1,
|
||||
V2,
|
||||
V3,
|
||||
V4,
|
||||
}
|
||||
Reference in new issue
Block a user