diff --git a/app/MindWork AI Studio/Chat/ContentText.cs b/app/MindWork AI Studio/Chat/ContentText.cs index f125d4b7..0354c756 100644 --- a/app/MindWork AI Studio/Chat/ContentText.cs +++ b/app/MindWork AI Studio/Chat/ContentText.cs @@ -70,7 +70,7 @@ public sealed class ContentText : IContent // Notify the UI that the content has changed, // depending on the energy saving mode: var now = DateTimeOffset.Now; - switch (settings.ConfigurationData.IsSavingEnergy) + switch (settings.ConfigurationData.App.IsSavingEnergy) { // Energy saving mode is off. We notify the UI // as fast as possible -- no matter the odds: diff --git a/app/MindWork AI Studio/Components/Blocks/ReadWebContent.razor.cs b/app/MindWork AI Studio/Components/Blocks/ReadWebContent.razor.cs index 56cbd60e..c4a34974 100644 --- a/app/MindWork AI Studio/Components/Blocks/ReadWebContent.razor.cs +++ b/app/MindWork AI Studio/Components/Blocks/ReadWebContent.razor.cs @@ -17,10 +17,7 @@ public partial class ReadWebContent : ComponentBase [Inject] protected SettingsManager SettingsManager { get; set; } = null!; - - [Inject] - protected IJSRuntime JsRuntime { get; init; } = null!; - + [Parameter] public string Content { get; set; } = string.Empty; @@ -63,8 +60,8 @@ public partial class ReadWebContent : ComponentBase if(this.PreselectContentCleanerAgent) this.useContentCleanerAgent = true; - if (this.SettingsManager.ConfigurationData.PreselectAgentTextContentCleanerOptions) - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedAgentTextContentCleanerProvider); + if (this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions) + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider); else this.providerSettings = this.ProviderSettings; @@ -73,7 +70,7 @@ public partial class ReadWebContent : ComponentBase protected override async Task OnParametersSetAsync() { - if (!this.SettingsManager.ConfigurationData.PreselectAgentTextContentCleanerOptions) + if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions) this.providerSettings = this.ProviderSettings; await base.OnParametersSetAsync(); diff --git a/app/MindWork AI Studio/Components/Layout/MainLayout.razor b/app/MindWork AI Studio/Components/Layout/MainLayout.razor index c7044e7b..63c4a46c 100644 --- a/app/MindWork AI Studio/Components/Layout/MainLayout.razor +++ b/app/MindWork AI Studio/Components/Layout/MainLayout.razor @@ -6,11 +6,11 @@ @if (!this.performingUpdate) { - + @foreach (var navBarItem in NAV_ITEMS) { - if (this.SettingsManager.ConfigurationData.NavigationBehavior is NavBehavior.NEVER_EXPAND_USE_TOOLTIPS) + if (this.SettingsManager.ConfigurationData.App.NavigationBehavior is NavBehavior.NEVER_EXPAND_USE_TOOLTIPS) { @navBarItem.Name diff --git a/app/MindWork AI Studio/Components/Layout/MainLayout.razor.cs b/app/MindWork AI Studio/Components/Layout/MainLayout.razor.cs index 8bd60a94..abc206cb 100644 --- a/app/MindWork AI Studio/Components/Layout/MainLayout.razor.cs +++ b/app/MindWork AI Studio/Components/Layout/MainLayout.razor.cs @@ -89,7 +89,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, IDis TemporaryChatService.Initialize(); // Should the navigation bar be open by default? - if(this.SettingsManager.ConfigurationData.NavigationBehavior is NavBehavior.ALWAYS_EXPAND) + if(this.SettingsManager.ConfigurationData.App.NavigationBehavior is NavBehavior.ALWAYS_EXPAND) this.navBarOpen = true; await base.OnInitializedAsync(); @@ -121,7 +121,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, IDis break; case Event.CONFIGURATION_CHANGED: - if(this.SettingsManager.ConfigurationData.NavigationBehavior is NavBehavior.ALWAYS_EXPAND) + if(this.SettingsManager.ConfigurationData.App.NavigationBehavior is NavBehavior.ALWAYS_EXPAND) this.navBarOpen = true; else this.navBarOpen = false; diff --git a/app/MindWork AI Studio/Components/Pages/Chat.razor b/app/MindWork AI Studio/Components/Pages/Chat.razor index 5a7f7fac..7decafff 100644 --- a/app/MindWork AI Studio/Components/Pages/Chat.razor +++ b/app/MindWork AI Studio/Components/Pages/Chat.razor @@ -32,14 +32,14 @@ - @if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) + @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) { } - @if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY) + @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY) { @@ -57,14 +57,14 @@ } - @if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) + @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { } - @if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) + @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) { @@ -75,7 +75,7 @@ -@if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior != WorkspaceStorageBehavior.DISABLE_WORKSPACES) +@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior != WorkspaceStorageBehavior.DISABLE_WORKSPACES) { diff --git a/app/MindWork AI Studio/Components/Pages/Chat.razor.cs b/app/MindWork AI Studio/Components/Pages/Chat.razor.cs index 05eae509..b040d9f7 100644 --- a/app/MindWork AI Studio/Components/Pages/Chat.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/Chat.razor.cs @@ -57,9 +57,9 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable // Configure the spellchecking for the user input: this.SettingsManager.InjectSpellchecking(USER_INPUT_ATTRIBUTES); - if (this.SettingsManager.ConfigurationData.PreselectChatOptions) + if (this.SettingsManager.ConfigurationData.Chat.PreselectOptions) { - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedChatProvider); + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Chat.PreselectedProvider); } await base.OnInitializedAsync(); @@ -120,7 +120,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable }); // Save the chat: - if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) + if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { await this.SaveThread(); this.hasUnsavedChanges = false; @@ -160,7 +160,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(), this.JsRuntime, this.SettingsManager, this.providerSettings.Model, this.chatThread); // Save the chat: - if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) + if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { await this.SaveThread(); this.hasUnsavedChanges = false; @@ -183,7 +183,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable var isModifier = keyEvent.AltKey || keyEvent.CtrlKey || keyEvent.MetaKey || keyEvent.ShiftKey; // Depending on the user's settings, might react to shortcuts: - switch (this.SettingsManager.ConfigurationData.ShortcutSendBehavior) + switch (this.SettingsManager.ConfigurationData.Chat.ShortcutSendBehavior) { case SendBehavior.ENTER_IS_SENDING: if (!isModifier && isEnter) @@ -232,7 +232,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable private async Task StartNewChat(bool useSameWorkspace = false, bool deletePreviousChat = false) { - if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) + if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) { var dialogParameters = new DialogParameters { @@ -294,7 +294,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable if(this.workspaces is null) return; - if (this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) + if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges) { var confirmationDialogParameters = new DialogParameters { @@ -385,7 +385,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable switch (triggeredEvent) { case Event.HAS_CHAT_UNSAVED_CHANGES: - if(this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) + if(this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) return Task.FromResult((TResult?) (object) false); return Task.FromResult((TResult?)(object)this.hasUnsavedChanges); @@ -400,7 +400,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable public async ValueTask DisposeAsync() { - if(this.SettingsManager.ConfigurationData.WorkspaceStorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) + if(this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { await this.SaveThread(); this.hasUnsavedChanges = false; diff --git a/app/MindWork AI Studio/Components/Pages/Coding/AssistantCoding.razor.cs b/app/MindWork AI Studio/Components/Pages/Coding/AssistantCoding.razor.cs index b4e50570..f0e552e3 100644 --- a/app/MindWork AI Studio/Components/Pages/Coding/AssistantCoding.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/Coding/AssistantCoding.razor.cs @@ -33,10 +33,10 @@ public partial class AssistantCoding : AssistantBaseCore protected override async Task OnInitializedAsync() { - if (this.SettingsManager.ConfigurationData.PreselectCodingOptions) + if (this.SettingsManager.ConfigurationData.Coding.PreselectOptions) { - this.provideCompilerMessages = this.SettingsManager.ConfigurationData.PreselectCodingCompilerMessages; - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedCodingProvider); + this.provideCompilerMessages = this.SettingsManager.ConfigurationData.Coding.PreselectCompilerMessages; + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Coding.PreselectedProvider); } await base.OnInitializedAsync(); @@ -68,8 +68,8 @@ public partial class AssistantCoding : AssistantBaseCore this.codingContexts.Add(new() { Id = $"Context {this.codingContexts.Count + 1}", - Language = this.SettingsManager.ConfigurationData.PreselectCodingOptions ? this.SettingsManager.ConfigurationData.PreselectedCodingLanguage : default, - OtherLanguage = this.SettingsManager.ConfigurationData.PreselectCodingOptions ? this.SettingsManager.ConfigurationData.PreselectedCodingOtherLanguage : string.Empty, + Language = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage : default, + OtherLanguage = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedOtherProgrammingLanguage : string.Empty, }); } diff --git a/app/MindWork AI Studio/Components/Pages/IconFinder/AssistantIconFinder.razor.cs b/app/MindWork AI Studio/Components/Pages/IconFinder/AssistantIconFinder.razor.cs index a2cf3671..d1f54e5e 100644 --- a/app/MindWork AI Studio/Components/Pages/IconFinder/AssistantIconFinder.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/IconFinder/AssistantIconFinder.razor.cs @@ -9,10 +9,10 @@ public partial class AssistantIconFinder : AssistantBaseCore protected override async Task OnInitializedAsync() { - if (this.SettingsManager.ConfigurationData.PreselectIconOptions) + if (this.SettingsManager.ConfigurationData.IconFinder.PreselectOptions) { - this.selectedIconSource = this.SettingsManager.ConfigurationData.PreselectedIconSource; - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedIconProvider); + this.selectedIconSource = this.SettingsManager.ConfigurationData.IconFinder.PreselectedSource; + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.IconFinder.PreselectedProvider); } await base.OnInitializedAsync(); diff --git a/app/MindWork AI Studio/Components/Pages/Settings.razor b/app/MindWork AI Studio/Components/Pages/Settings.razor index 0f0e788a..d6025b21 100644 --- a/app/MindWork AI Studio/Components/Pages/Settings.razor +++ b/app/MindWork AI Studio/Components/Pages/Settings.razor @@ -68,74 +68,74 @@ App Options - - - - + + + + Chat Options - - - + + + Workspace Options - - + + Assistant Options Icon Finder Options - - - + + + Translator Options - - + + - - - - - - @if (this.SettingsManager.ConfigurationData.PreselectedTranslationTargetLanguage is CommonLanguages.OTHER) + + + + + + @if (this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage is CommonLanguages.OTHER) { - + } - + Coding Options - - - - @if (this.SettingsManager.ConfigurationData.PreselectedCodingLanguage is CommonCodingLanguages.OTHER) + + + + @if (this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage is CommonCodingLanguages.OTHER) { - + } - + Text Summarizer Options - + - - - - - @if (this.SettingsManager.ConfigurationData.PreselectedTextSummarizerTargetLanguage is CommonLanguages.OTHER) + + + + + @if (this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage is CommonLanguages.OTHER) { - + } - - @if(this.SettingsManager.ConfigurationData.PreselectedTextSummarizerComplexity is Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS) + + @if(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity is Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS) { - + } - + LLM Agent Options @@ -146,8 +146,8 @@ Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used. - - + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor b/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor index 98a7d4c0..dc2b130b 100644 --- a/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor +++ b/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor @@ -2,9 +2,9 @@ @using AIStudio.Tools @inherits AssistantBaseCore -@if (!this.SettingsManager.ConfigurationData.HideWebContentReaderForTextSummarizer) +@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader) { - + } diff --git a/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor.cs b/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor.cs index 11f54bcc..f0badef0 100644 --- a/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/TextSummarizer/AssistantTextSummarizer.razor.cs @@ -34,13 +34,13 @@ public partial class AssistantTextSummarizer : AssistantBaseCore protected override async Task OnInitializedAsync() { - if(this.SettingsManager.ConfigurationData.PreselectTextSummarizerOptions) + if(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions) { - this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.PreselectedTextSummarizerTargetLanguage; - this.customTargetLanguage = this.SettingsManager.ConfigurationData.PreselectedTextSummarizerOtherLanguage; - this.selectedComplexity = this.SettingsManager.ConfigurationData.PreselectedTextSummarizerComplexity; - this.expertInField = this.SettingsManager.ConfigurationData.PreselectedTextSummarizerExpertInField; - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedTextSummarizerProvider); + this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage; + this.customTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedOtherLanguage; + this.selectedComplexity = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity; + this.expertInField = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedExpertInField; + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedProvider); } await base.OnInitializedAsync(); diff --git a/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor b/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor index 7818c512..df54b13d 100644 --- a/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor +++ b/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor @@ -2,15 +2,15 @@ @using AIStudio.Tools @inherits AssistantBaseCore -@if (!this.SettingsManager.ConfigurationData.HideWebContentReaderForTranslation) +@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader) { - + } @if (this.liveTranslation) { - + } else { diff --git a/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor.cs b/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor.cs index 6001556a..20fe8fe7 100644 --- a/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor.cs +++ b/app/MindWork AI Studio/Components/Pages/Translation/AssistantTranslation.razor.cs @@ -30,12 +30,12 @@ public partial class AssistantTranslation : AssistantBaseCore protected override async Task OnInitializedAsync() { - if (this.SettingsManager.ConfigurationData.PreselectTranslationOptions) + if (this.SettingsManager.ConfigurationData.Translation.PreselectOptions) { - this.liveTranslation = this.SettingsManager.ConfigurationData.PreselectLiveTranslation; - this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.PreselectedTranslationTargetLanguage; - this.customTargetLanguage = this.SettingsManager.ConfigurationData.PreselectTranslationOtherLanguage; - this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedTranslationProvider); + this.liveTranslation = this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation; + this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage; + this.customTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage; + this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.Translation.PreselectedProvider); } await base.OnInitializedAsync(); diff --git a/app/MindWork AI Studio/Settings/DataModel/Data.cs b/app/MindWork AI Studio/Settings/DataModel/Data.cs index 7ed60225..3d811a56 100644 --- a/app/MindWork AI Studio/Settings/DataModel/Data.cs +++ b/app/MindWork AI Studio/Settings/DataModel/Data.cs @@ -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; /// @@ -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. /// - public Version Version { get; init; } = Version.V3; + public Version Version { get; init; } = Version.V4; /// /// List of configured providers. @@ -26,222 +21,19 @@ public sealed class Data /// public uint NextProviderNum { get; set; } = 1; - #region App Settings - - /// - /// Should we save energy? When true, we will update content streamed - /// from the server, i.e., AI, less frequently. - /// - public bool IsSavingEnergy { get; set; } - - /// - /// Should we enable spellchecking for all input fields? - /// - public bool EnableSpellchecking { get; set; } + public DataApp App { get; init; } = new(); - /// - /// If and when we should look for updates. - /// - public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP; - - /// - /// The navigation behavior. - /// - public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER; - - #endregion + public DataChat Chat { get; init; } = new(); - #region Chat Settings + public DataWorkspace Workspace { get; init; } = new(); - /// - /// Shortcuts to send the input to the AI. - /// - public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING; + public DataIconFinder IconFinder { get; init; } = new(); - /// - /// Preselect any chat options? - /// - public bool PreselectChatOptions { get; set; } + public DataTranslation Translation { get; init; } = new(); - /// - /// Should we preselect a provider for the chat? - /// - public string PreselectedChatProvider { get; set; } = string.Empty; + public DataCoding Coding { get; init; } = new(); - #endregion + public DataTextSummarizer TextSummarizer { get; init; } = new(); - #region Workspace Settings - - /// - /// The chat storage behavior. - /// - public WorkspaceStorageBehavior WorkspaceStorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY; - - /// - /// The chat storage maintenance behavior. - /// - public WorkspaceStorageTemporaryMaintenancePolicy WorkspaceStorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS; - - #endregion - - #region Assiatant: Icon Finder Settings - - /// - /// Do we want to preselect any icon options? - /// - public bool PreselectIconOptions { get; set; } - - /// - /// The preselected icon source. - /// - public IconSources PreselectedIconSource { get; set; } - - /// - /// The preselected icon provider. - /// - public string PreselectedIconProvider { get; set; } = string.Empty; - - #endregion - - #region Assistant: Translation Settings - - /// - /// The live translation interval for debouncing in milliseconds. - /// - public int LiveTranslationDebounceIntervalMilliseconds { get; set; } = 1_500; - - /// - /// Do we want to preselect any translator options? - /// - public bool PreselectTranslationOptions { get; set; } - - /// - /// Preselect the live translation? - /// - public bool PreselectLiveTranslation { get; set; } - - /// - /// Hide the web content reader? - /// - public bool HideWebContentReaderForTranslation { get; set; } - - /// - /// Preselect the web content reader? - /// - public bool PreselectWebContentReaderForTranslation { get; set; } - - /// - /// Preselect the content cleaner agent? - /// - public bool PreselectContentCleanerAgentForTranslation { get; set; } - - /// - /// Preselect the target language? - /// - public CommonLanguages PreselectedTranslationTargetLanguage { get; set; } = CommonLanguages.EN_US; - - /// - /// Preselect any other language? - /// - public string PreselectTranslationOtherLanguage { get; set; } = string.Empty; - - /// - /// The preselected translator provider. - /// - public string PreselectedTranslationProvider { get; set; } = string.Empty; - - #endregion - - #region Assistant: Coding Settings - - /// - /// Preselect any coding options? - /// - public bool PreselectCodingOptions { get; set; } - - /// - /// Preselect the compiler messages? - /// - public bool PreselectCodingCompilerMessages { get; set; } - - /// - /// Preselect the coding language for new contexts? - /// - public CommonCodingLanguages PreselectedCodingLanguage { get; set; } - - /// - /// Do you want to preselect any other language? - /// - public string PreselectedCodingOtherLanguage { get; set; } = string.Empty; - - /// - /// Which coding provider should be preselected? - /// - public string PreselectedCodingProvider { get; set; } = string.Empty; - - #endregion - - #region Assistant: Text Summarizer Settings - - /// - /// Preselect any text summarizer options? - /// - public bool PreselectTextSummarizerOptions { get; set; } - - - /// - /// Hide the web content reader? - /// - public bool HideWebContentReaderForTextSummarizer { get; set; } - - /// - /// Preselect the web content reader? - /// - public bool PreselectWebContentReaderForTextSummarizer { get; set; } - - /// - /// Preselect the content cleaner agent? - /// - public bool PreselectContentCleanerAgentForTextSummarizer { get; set; } - - /// - /// Preselect the target language? - /// - public CommonLanguages PreselectedTextSummarizerTargetLanguage { get; set; } - - /// - /// Preselect any other language? - /// - public string PreselectedTextSummarizerOtherLanguage { get; set; } = string.Empty; - - /// - /// Preselect the complexity? - /// - public Complexity PreselectedTextSummarizerComplexity { get; set; } - - /// - /// Preselect any expertise in a field? - /// - public string PreselectedTextSummarizerExpertInField { get; set; } = string.Empty; - - /// - /// Preselect a text summarizer provider? - /// - public string PreselectedTextSummarizerProvider { get; set; } = string.Empty; - - #endregion - - #region Agent: Text Content Cleaner Settings - - /// - /// Preselect any text content cleaner options? - /// - public bool PreselectAgentTextContentCleanerOptions { get; set; } - - /// - /// Preselect a text content cleaner provider? - /// - public string PreselectedAgentTextContentCleanerProvider { get; set; } = string.Empty; - - #endregion + public DataTextContentCleaner TextContentCleaner { get; init; } = new(); } \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs new file mode 100644 index 00000000..885ab9a7 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs @@ -0,0 +1,25 @@ +namespace AIStudio.Settings.DataModel; + +public sealed class DataApp +{ + /// + /// Should we save energy? When true, we will update content streamed + /// from the server, i.e., AI, less frequently. + /// + public bool IsSavingEnergy { get; set; } + + /// + /// Should we enable spellchecking for all input fields? + /// + public bool EnableSpellchecking { get; set; } + + /// + /// If and when we should look for updates. + /// + public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP; + + /// + /// The navigation behavior. + /// + public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataChat.cs b/app/MindWork AI Studio/Settings/DataModel/DataChat.cs new file mode 100644 index 00000000..825bfc9f --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataChat.cs @@ -0,0 +1,19 @@ +namespace AIStudio.Settings.DataModel; + +public sealed class DataChat +{ + /// + /// Shortcuts to send the input to the AI. + /// + public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING; + + /// + /// Preselect any chat options? + /// + public bool PreselectOptions { get; set; } + + /// + /// Should we preselect a provider for the chat? + /// + public string PreselectedProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataCoding.cs b/app/MindWork AI Studio/Settings/DataModel/DataCoding.cs new file mode 100644 index 00000000..052c319a --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataCoding.cs @@ -0,0 +1,31 @@ +using AIStudio.Components.Pages.Coding; + +namespace AIStudio.Settings.DataModel; + +public sealed class DataCoding +{ + /// + /// Preselect any coding options? + /// + public bool PreselectOptions { get; set; } + + /// + /// Preselect the compiler messages? + /// + public bool PreselectCompilerMessages { get; set; } + + /// + /// Preselect the coding language for new contexts? + /// + public CommonCodingLanguages PreselectedProgrammingLanguage { get; set; } + + /// + /// Do you want to preselect any other language? + /// + public string PreselectedOtherProgrammingLanguage { get; set; } = string.Empty; + + /// + /// Which coding provider should be preselected? + /// + public string PreselectedProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataIconFinder.cs b/app/MindWork AI Studio/Settings/DataModel/DataIconFinder.cs new file mode 100644 index 00000000..d47c3df0 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataIconFinder.cs @@ -0,0 +1,21 @@ +using AIStudio.Components.Pages.IconFinder; + +namespace AIStudio.Settings.DataModel; + +public sealed class DataIconFinder +{ + /// + /// Do we want to preselect any icon options? + /// + public bool PreselectOptions { get; set; } + + /// + /// The preselected icon source. + /// + public IconSources PreselectedSource { get; set; } + + /// + /// The preselected icon provider. + /// + public string PreselectedProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataTextContentCleaner.cs b/app/MindWork AI Studio/Settings/DataModel/DataTextContentCleaner.cs new file mode 100644 index 00000000..c1e7137e --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataTextContentCleaner.cs @@ -0,0 +1,14 @@ +namespace AIStudio.Settings.DataModel; + +public sealed class DataTextContentCleaner +{ + /// + /// Preselect any text content cleaner options? + /// + public bool PreselectAgentOptions { get; set; } + + /// + /// Preselect a text content cleaner provider? + /// + public string PreselectedAgentProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataTextSummarizer.cs b/app/MindWork AI Studio/Settings/DataModel/DataTextSummarizer.cs new file mode 100644 index 00000000..e6ee9ea8 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataTextSummarizer.cs @@ -0,0 +1,53 @@ +using AIStudio.Components.Pages.TextSummarizer; +using AIStudio.Tools; + +namespace AIStudio.Settings.DataModel; + +public sealed class DataTextSummarizer +{ + /// + /// Preselect any text summarizer options? + /// + public bool PreselectOptions { get; set; } + + + /// + /// Hide the web content reader? + /// + public bool HideWebContentReader { get; set; } + + /// + /// Preselect the web content reader? + /// + public bool PreselectWebContentReader { get; set; } + + /// + /// Preselect the content cleaner agent? + /// + public bool PreselectContentCleanerAgent { get; set; } + + /// + /// Preselect the target language? + /// + public CommonLanguages PreselectedTargetLanguage { get; set; } + + /// + /// Preselect any other language? + /// + public string PreselectedOtherLanguage { get; set; } = string.Empty; + + /// + /// Preselect the complexity? + /// + public Complexity PreselectedComplexity { get; set; } + + /// + /// Preselect any expertise in a field? + /// + public string PreselectedExpertInField { get; set; } = string.Empty; + + /// + /// Preselect a text summarizer provider? + /// + public string PreselectedProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataTranslation.cs b/app/MindWork AI Studio/Settings/DataModel/DataTranslation.cs new file mode 100644 index 00000000..26c5aba9 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataTranslation.cs @@ -0,0 +1,51 @@ +using AIStudio.Tools; + +namespace AIStudio.Settings.DataModel; + +public sealed class DataTranslation +{ + /// + /// The live translation interval for debouncing in milliseconds. + /// + public int DebounceIntervalMilliseconds { get; set; } = 1_500; + + /// + /// Do we want to preselect any translator options? + /// + public bool PreselectOptions { get; set; } + + /// + /// Preselect the live translation? + /// + public bool PreselectLiveTranslation { get; set; } + + /// + /// Hide the web content reader? + /// + public bool HideWebContentReader { get; set; } + + /// + /// Preselect the web content reader? + /// + public bool PreselectWebContentReader { get; set; } + + /// + /// Preselect the content cleaner agent? + /// + public bool PreselectContentCleanerAgent { get; set; } + + /// + /// Preselect the target language? + /// + public CommonLanguages PreselectedTargetLanguage { get; set; } = CommonLanguages.EN_US; + + /// + /// Preselect any other language? + /// + public string PreselectOtherLanguage { get; set; } = string.Empty; + + /// + /// The preselected translator provider. + /// + public string PreselectedProvider { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataWorkspace.cs b/app/MindWork AI Studio/Settings/DataModel/DataWorkspace.cs new file mode 100644 index 00000000..5041fc12 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/DataWorkspace.cs @@ -0,0 +1,14 @@ +namespace AIStudio.Settings.DataModel; + +public sealed class DataWorkspace +{ + /// + /// The chat storage behavior. + /// + public WorkspaceStorageBehavior StorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY; + + /// + /// The chat storage maintenance behavior. + /// + public WorkspaceStorageTemporaryMaintenancePolicy StorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/PreviousModels/DataV1V3.cs b/app/MindWork AI Studio/Settings/DataModel/PreviousModels/DataV1V3.cs new file mode 100644 index 00000000..b19c7b45 --- /dev/null +++ b/app/MindWork AI Studio/Settings/DataModel/PreviousModels/DataV1V3.cs @@ -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; + +/// +/// The data model for the settings file. +/// +public sealed class DataV1V3 +{ + /// + /// The version of the settings file. Allows us to upgrade the settings + /// when a new version is available. + /// + public Version Version { get; init; } = Version.V3; + + /// + /// List of configured providers. + /// + public List Providers { get; init; } = []; + + /// + /// The next provider number to use. + /// + public uint NextProviderNum { get; set; } = 1; + + #region App Settings + + /// + /// Should we save energy? When true, we will update content streamed + /// from the server, i.e., AI, less frequently. + /// + public bool IsSavingEnergy { get; set; } + + /// + /// Should we enable spellchecking for all input fields? + /// + public bool EnableSpellchecking { get; set; } + + /// + /// If and when we should look for updates. + /// + public UpdateBehavior UpdateBehavior { get; set; } = UpdateBehavior.ONCE_STARTUP; + + /// + /// The navigation behavior. + /// + public NavBehavior NavigationBehavior { get; set; } = NavBehavior.EXPAND_ON_HOVER; + + #endregion + + #region Chat Settings + + /// + /// Shortcuts to send the input to the AI. + /// + public SendBehavior ShortcutSendBehavior { get; set; } = SendBehavior.MODIFER_ENTER_IS_SENDING; + + /// + /// Preselect any chat options? + /// + public bool PreselectChatOptions { get; set; } + + /// + /// Should we preselect a provider for the chat? + /// + public string PreselectedChatProvider { get; set; } = string.Empty; + + #endregion + + #region Workspace Settings + + /// + /// The chat storage behavior. + /// + public WorkspaceStorageBehavior WorkspaceStorageBehavior { get; set; } = WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY; + + /// + /// The chat storage maintenance behavior. + /// + public WorkspaceStorageTemporaryMaintenancePolicy WorkspaceStorageTemporaryMaintenancePolicy { get; set; } = WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_90_DAYS; + + #endregion + + #region Assiatant: Icon Finder Settings + + /// + /// Do we want to preselect any icon options? + /// + public bool PreselectIconOptions { get; set; } + + /// + /// The preselected icon source. + /// + public IconSources PreselectedIconSource { get; set; } + + /// + /// The preselected icon provider. + /// + public string PreselectedIconProvider { get; set; } = string.Empty; + + #endregion + + #region Assistant: Translation Settings + + /// + /// The live translation interval for debouncing in milliseconds. + /// + public int LiveTranslationDebounceIntervalMilliseconds { get; set; } = 1_500; + + /// + /// Do we want to preselect any translator options? + /// + public bool PreselectTranslationOptions { get; set; } + + /// + /// Preselect the live translation? + /// + public bool PreselectLiveTranslation { get; set; } + + /// + /// Hide the web content reader? + /// + public bool HideWebContentReaderForTranslation { get; set; } + + /// + /// Preselect the web content reader? + /// + public bool PreselectWebContentReaderForTranslation { get; set; } + + /// + /// Preselect the content cleaner agent? + /// + public bool PreselectContentCleanerAgentForTranslation { get; set; } + + /// + /// Preselect the target language? + /// + public CommonLanguages PreselectedTranslationTargetLanguage { get; set; } = CommonLanguages.EN_US; + + /// + /// Preselect any other language? + /// + public string PreselectTranslationOtherLanguage { get; set; } = string.Empty; + + /// + /// The preselected translator provider. + /// + public string PreselectedTranslationProvider { get; set; } = string.Empty; + + #endregion + + #region Assistant: Coding Settings + + /// + /// Preselect any coding options? + /// + public bool PreselectCodingOptions { get; set; } + + /// + /// Preselect the compiler messages? + /// + public bool PreselectCodingCompilerMessages { get; set; } + + /// + /// Preselect the coding language for new contexts? + /// + public CommonCodingLanguages PreselectedCodingLanguage { get; set; } + + /// + /// Do you want to preselect any other language? + /// + public string PreselectedCodingOtherLanguage { get; set; } = string.Empty; + + /// + /// Which coding provider should be preselected? + /// + public string PreselectedCodingProvider { get; set; } = string.Empty; + + #endregion + + #region Assistant: Text Summarizer Settings + + /// + /// Preselect any text summarizer options? + /// + public bool PreselectTextSummarizerOptions { get; set; } + + + /// + /// Hide the web content reader? + /// + public bool HideWebContentReaderForTextSummarizer { get; set; } + + /// + /// Preselect the web content reader? + /// + public bool PreselectWebContentReaderForTextSummarizer { get; set; } + + /// + /// Preselect the content cleaner agent? + /// + public bool PreselectContentCleanerAgentForTextSummarizer { get; set; } + + /// + /// Preselect the target language? + /// + public CommonLanguages PreselectedTextSummarizerTargetLanguage { get; set; } + + /// + /// Preselect any other language? + /// + public string PreselectedTextSummarizerOtherLanguage { get; set; } = string.Empty; + + /// + /// Preselect the complexity? + /// + public Complexity PreselectedTextSummarizerComplexity { get; set; } + + /// + /// Preselect any expertise in a field? + /// + public string PreselectedTextSummarizerExpertInField { get; set; } = string.Empty; + + /// + /// Preselect a text summarizer provider? + /// + public string PreselectedTextSummarizerProvider { get; set; } = string.Empty; + + #endregion + + #region Agent: Text Content Cleaner Settings + + /// + /// Preselect any text content cleaner options? + /// + public bool PreselectAgentTextContentCleanerOptions { get; set; } + + /// + /// Preselect a text content cleaner provider? + /// + public string PreselectedAgentTextContentCleanerProvider { get; set; } = string.Empty; + + #endregion +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/SettingsManager.cs b/app/MindWork AI Studio/Settings/SettingsManager.cs index 26151a12..c4cbc443 100644 --- a/app/MindWork AI Studio/Settings/SettingsManager.cs +++ b/app/MindWork AI Studio/Settings/SettingsManager.cs @@ -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(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(); } /// @@ -132,5 +152,5 @@ public sealed class SettingsManager await File.WriteAllTextAsync(settingsPath, settingsJson); } - public void InjectSpellchecking(Dictionary attributes) => attributes["spellcheck"] = this.ConfigurationData.EnableSpellchecking ? "true" : "false"; + public void InjectSpellchecking(Dictionary attributes) => attributes["spellcheck"] = this.ConfigurationData.App.EnableSpellchecking ? "true" : "false"; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/SettingsMigrations.cs b/app/MindWork AI Studio/Settings/SettingsMigrations.cs index 6e1669d9..121d96c9 100644 --- a/app/MindWork AI Studio/Settings/SettingsMigrations.cs +++ b/app/MindWork AI Studio/Settings/SettingsMigrations.cs @@ -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(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(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(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(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, + }, + }; + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/Version.cs b/app/MindWork AI Studio/Settings/Version.cs index cb30052d..2b38b8fc 100644 --- a/app/MindWork AI Studio/Settings/Version.cs +++ b/app/MindWork AI Studio/Settings/Version.cs @@ -11,4 +11,5 @@ public enum Version V1, V2, V3, + V4, } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/TemporaryChatService.cs b/app/MindWork AI Studio/Tools/TemporaryChatService.cs index f820716c..0e76279a 100644 --- a/app/MindWork AI Studio/Tools/TemporaryChatService.cs +++ b/app/MindWork AI Studio/Tools/TemporaryChatService.cs @@ -16,7 +16,7 @@ public class TemporaryChatService(SettingsManager settingsManager) : BackgroundS await Task.Delay(TimeSpan.FromSeconds(3), stoppingToken); await settingsManager.LoadSettings(); - if(settingsManager.ConfigurationData.WorkspaceStorageTemporaryMaintenancePolicy is WorkspaceStorageTemporaryMaintenancePolicy.NO_AUTOMATIC_MAINTENANCE) + if(settingsManager.ConfigurationData.Workspace.StorageTemporaryMaintenancePolicy is WorkspaceStorageTemporaryMaintenancePolicy.NO_AUTOMATIC_MAINTENANCE) { Console.WriteLine("Automatic maintenance of temporary chat storage is disabled. Exiting maintenance service."); return; @@ -46,7 +46,7 @@ public class TemporaryChatService(SettingsManager settingsManager) : BackgroundS continue; var lastWriteTime = chatMetadata.LastWriteTimeUtc; - var deleteChat = settingsManager.ConfigurationData.WorkspaceStorageTemporaryMaintenancePolicy switch + var deleteChat = settingsManager.ConfigurationData.Workspace.StorageTemporaryMaintenancePolicy switch { WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_7_DAYS => DateTime.UtcNow - lastWriteTime > TimeSpan.FromDays(7), WorkspaceStorageTemporaryMaintenancePolicy.DELETE_OLDER_THAN_30_DAYS => DateTime.UtcNow - lastWriteTime > TimeSpan.FromDays(30), diff --git a/app/MindWork AI Studio/Tools/UpdateService.cs b/app/MindWork AI Studio/Tools/UpdateService.cs index 71fcb9b5..6f6c07d8 100644 --- a/app/MindWork AI Studio/Tools/UpdateService.cs +++ b/app/MindWork AI Studio/Tools/UpdateService.cs @@ -37,7 +37,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver while (!stoppingToken.IsCancellationRequested && !IS_INITIALIZED) await Task.Delay(TimeSpan.FromSeconds(3), stoppingToken); - this.updateInterval = this.settingsManager.ConfigurationData.UpdateBehavior switch + this.updateInterval = this.settingsManager.ConfigurationData.App.UpdateBehavior switch { UpdateBehavior.NO_CHECK => Timeout.InfiniteTimeSpan, UpdateBehavior.ONCE_STARTUP => Timeout.InfiniteTimeSpan, @@ -49,7 +49,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver _ => TimeSpan.FromHours(1) }; - if(this.settingsManager.ConfigurationData.UpdateBehavior is UpdateBehavior.NO_CHECK) + if(this.settingsManager.ConfigurationData.App.UpdateBehavior is UpdateBehavior.NO_CHECK) return; await this.CheckForUpdate();