From 785350a091b767dd0d7a49122b68adcff1110cdb Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 2 Jan 2025 13:09:41 +0100 Subject: [PATCH] Refactored LoadedChatWasChanged to use the event system --- app/MindWork AI Studio/Components/Workspaces.razor.cs | 9 +++------ app/MindWork AI Studio/Tools/Event.cs | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index 2f96f023..1ec3c0e1 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -31,9 +31,6 @@ public partial class Workspaces : ComponentBase [Parameter] public EventCallback CurrentChatThreadChanged { get; set; } - [Parameter] - public Func LoadedChatWasChanged { get; set; } = () => Task.CompletedTask; - [Parameter] public bool ExpandRootNodes { get; set; } = true; @@ -273,7 +270,7 @@ public partial class Workspaces : ComponentBase { this.CurrentChatThread = chat; await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread); - await this.LoadedChatWasChanged(); + await MessageBus.INSTANCE.SendMessage(this, Event.WORKSPACE_LOADED_CHAT_CHANGED); } return chat; @@ -325,7 +322,7 @@ public partial class Workspaces : ComponentBase { this.CurrentChatThread = null; await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread); - await this.LoadedChatWasChanged(); + await MessageBus.INSTANCE.SendMessage(this, Event.WORKSPACE_LOADED_CHAT_CHANGED); } } @@ -471,7 +468,7 @@ public partial class Workspaces : ComponentBase { this.CurrentChatThread = chat; await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread); - await this.LoadedChatWasChanged(); + await MessageBus.INSTANCE.SendMessage(this, Event.WORKSPACE_LOADED_CHAT_CHANGED); } await this.StoreChat(chat); diff --git a/app/MindWork AI Studio/Tools/Event.cs b/app/MindWork AI Studio/Tools/Event.cs index 2dde28a3..7220006f 100644 --- a/app/MindWork AI Studio/Tools/Event.cs +++ b/app/MindWork AI Studio/Tools/Event.cs @@ -19,6 +19,8 @@ public enum Event LOAD_CHAT, CHAT_STREAMING_DONE, + // Workspace events: + WORKSPACE_LOADED_CHAT_CHANGED, // Send events: SEND_TO_GRAMMAR_SPELLING_ASSISTANT, SEND_TO_ICON_FINDER_ASSISTANT,