diff --git a/app/MindWork AI Studio/Assistants/BiasDay/BiasOfTheDayAssistant.razor.cs b/app/MindWork AI Studio/Assistants/BiasDay/BiasOfTheDayAssistant.razor.cs index 2901a1b1..576e4332 100644 --- a/app/MindWork AI Studio/Assistants/BiasDay/BiasOfTheDayAssistant.razor.cs +++ b/app/MindWork AI Studio/Assistants/BiasDay/BiasOfTheDayAssistant.razor.cs @@ -1,6 +1,6 @@ using System.Text; -using AIStudio.Components; +using AIStudio.Chat; using AIStudio.Settings.DataModel; namespace AIStudio.Assistants.BiasDay; @@ -124,7 +124,7 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore { var biasChat = new LoadChat { - WorkspaceId = Workspaces.WORKSPACE_ID_BIAS, + WorkspaceId = KnownWorkspaces.BIAS_WORKSPACE_ID, ChatId = this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId, }; @@ -147,7 +147,7 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore BiasCatalog.ALL_BIAS[this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayId] : BiasCatalog.GetRandomBias(this.SettingsManager.ConfigurationData.BiasOfTheDay.UsedBias); - var chatId = this.CreateChatThread(Workspaces.WORKSPACE_ID_BIAS, this.biasOfTheDay.Name); + var chatId = this.CreateChatThread(KnownWorkspaces.BIAS_WORKSPACE_ID, this.biasOfTheDay.Name); this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayId = this.biasOfTheDay.Id; this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId = chatId; this.SettingsManager.ConfigurationData.BiasOfTheDay.DateLastBiasDrawn = DateOnly.FromDateTime(DateTime.Now); diff --git a/app/MindWork AI Studio/Chat/KnownWorkspaces.cs b/app/MindWork AI Studio/Chat/KnownWorkspaces.cs new file mode 100644 index 00000000..be19ad2c --- /dev/null +++ b/app/MindWork AI Studio/Chat/KnownWorkspaces.cs @@ -0,0 +1,6 @@ +namespace AIStudio.Chat; + +public static class KnownWorkspaces +{ + public static readonly Guid BIAS_WORKSPACE_ID = Guid.Parse("82050a4e-ee92-43d7-8ee5-ab512f847e02"); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index 84181dbb..2f96f023 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -38,8 +38,6 @@ public partial class Workspaces : ComponentBase public bool ExpandRootNodes { get; set; } = true; private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom; - - public static readonly Guid WORKSPACE_ID_BIAS = Guid.Parse("82050a4e-ee92-43d7-8ee5-ab512f847e02"); private readonly List> treeItems = new(); @@ -53,8 +51,6 @@ public partial class Workspaces : ComponentBase // - Those initial tree items cannot have children // - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item // - - await this.EnsureBiasWorkspace(); await this.LoadTreeItems(); await base.OnInitializedAsync(); } @@ -408,18 +404,6 @@ public partial class Workspaces : ComponentBase await this.LoadTreeItems(); } - private async Task EnsureBiasWorkspace() - { - var workspacePath = Path.Join(SettingsManager.DataDirectory, "workspaces", WORKSPACE_ID_BIAS.ToString()); - - if(Path.Exists(workspacePath)) - return; - - Directory.CreateDirectory(workspacePath); - var workspaceNamePath = Path.Join(workspacePath, "name"); - await File.WriteAllTextAsync(workspaceNamePath, "Bias of the Day", Encoding.UTF8); - } - private async Task DeleteWorkspace(string? workspacePath) { if(workspacePath is null) diff --git a/app/MindWork AI Studio/Pages/Chat.razor.cs b/app/MindWork AI Studio/Pages/Chat.razor.cs index fd87a0b0..fc5f23c1 100644 --- a/app/MindWork AI Studio/Pages/Chat.razor.cs +++ b/app/MindWork AI Studio/Pages/Chat.razor.cs @@ -61,6 +61,9 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable // Configure the spellchecking for the user input: this.SettingsManager.InjectSpellchecking(USER_INPUT_ATTRIBUTES); + // Ensure the bias workspace exists: + await WorkspaceBehaviour.EnsureBiasWorkspace(); + this.currentProfile = this.SettingsManager.GetPreselectedProfile(Tools.Components.CHAT); var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages(Event.SEND_TO_CHAT).FirstOrDefault(); if (deferredContent is not null) diff --git a/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs b/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs index 942374a1..58cc70b5 100644 --- a/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs +++ b/app/MindWork AI Studio/Tools/WorkspaceBehaviour.cs @@ -117,4 +117,16 @@ public static class WorkspaceBehaviour Directory.Delete(chatDirectory, true); } + + public static async Task EnsureBiasWorkspace() + { + var workspacePath = Path.Join(SettingsManager.DataDirectory, "workspaces", KnownWorkspaces.BIAS_WORKSPACE_ID.ToString()); + + if(Path.Exists(workspacePath)) + return; + + Directory.CreateDirectory(workspacePath); + var workspaceNamePath = Path.Join(workspacePath, "name"); + await File.WriteAllTextAsync(workspaceNamePath, "Bias of the Day", Encoding.UTF8); + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.23.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.23.md index 286a40e0..ae964d7c 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.23.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.23.md @@ -1,4 +1,5 @@ # v0.9.23, build 198 (2024-12-xx xx:xx UTC) - Added an ERI server coding assistant as a preview feature behind the RAG feature flag. This helps you implement an ERI server to gain access to, e.g., your enterprise data from within AI Studio. - Improved provider requests by handling rate limits by retrying requests. -- Fixed layout issues when selecting `other` items (e.g., programming languages) \ No newline at end of file +- Fixed layout issues when selecting `other` items (e.g., programming languages). +- Fixed a bug about the bias of the day workspace when the workspace component was hidden. \ No newline at end of file