Refactored LoadedChatWasChanged to use the event system

This commit is contained in:
Thorsten Sommer 2025-01-02 13:09:41 +01:00
parent 513f1d0ce8
commit 785350a091
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 5 additions and 6 deletions

View File

@ -31,9 +31,6 @@ public partial class Workspaces : ComponentBase
[Parameter]
public EventCallback<ChatThread> CurrentChatThreadChanged { get; set; }
[Parameter]
public Func<Task> 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<bool>(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<bool>(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<bool>(this, Event.WORKSPACE_LOADED_CHAT_CHANGED);
}
await this.StoreChat(chat);

View File

@ -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,