mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-03 09:39:47 +00:00
Refactored LoadedChatWasChanged to use the event system
This commit is contained in:
parent
513f1d0ce8
commit
785350a091
@ -31,9 +31,6 @@ public partial class Workspaces : ComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<ChatThread> CurrentChatThreadChanged { get; set; }
|
public EventCallback<ChatThread> CurrentChatThreadChanged { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public Func<Task> LoadedChatWasChanged { get; set; } = () => Task.CompletedTask;
|
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool ExpandRootNodes { get; set; } = true;
|
public bool ExpandRootNodes { get; set; } = true;
|
||||||
|
|
||||||
@ -273,7 +270,7 @@ public partial class Workspaces : ComponentBase
|
|||||||
{
|
{
|
||||||
this.CurrentChatThread = chat;
|
this.CurrentChatThread = chat;
|
||||||
await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread);
|
await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread);
|
||||||
await this.LoadedChatWasChanged();
|
await MessageBus.INSTANCE.SendMessage<bool>(this, Event.WORKSPACE_LOADED_CHAT_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return chat;
|
return chat;
|
||||||
@ -325,7 +322,7 @@ public partial class Workspaces : ComponentBase
|
|||||||
{
|
{
|
||||||
this.CurrentChatThread = null;
|
this.CurrentChatThread = null;
|
||||||
await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread);
|
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;
|
this.CurrentChatThread = chat;
|
||||||
await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread);
|
await this.CurrentChatThreadChanged.InvokeAsync(this.CurrentChatThread);
|
||||||
await this.LoadedChatWasChanged();
|
await MessageBus.INSTANCE.SendMessage<bool>(this, Event.WORKSPACE_LOADED_CHAT_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.StoreChat(chat);
|
await this.StoreChat(chat);
|
||||||
|
@ -19,6 +19,8 @@ public enum Event
|
|||||||
LOAD_CHAT,
|
LOAD_CHAT,
|
||||||
CHAT_STREAMING_DONE,
|
CHAT_STREAMING_DONE,
|
||||||
|
|
||||||
|
// Workspace events:
|
||||||
|
WORKSPACE_LOADED_CHAT_CHANGED,
|
||||||
// Send events:
|
// Send events:
|
||||||
SEND_TO_GRAMMAR_SPELLING_ASSISTANT,
|
SEND_TO_GRAMMAR_SPELLING_ASSISTANT,
|
||||||
SEND_TO_ICON_FINDER_ASSISTANT,
|
SEND_TO_ICON_FINDER_ASSISTANT,
|
||||||
|
Loading…
Reference in New Issue
Block a user