mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 09:53:48 +00:00
Fixed message bus issues (#268)
This commit is contained in:
1 parent
cf975f2a6c
commit
be408a6aee
15 files changed
+47
-4
No files matched your search
@@ -147,6 +147,8 @@ public abstract partial class AssistantBase : ComponentBase, IMessageBusReceiver
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(AssistantBase);
|
||||
|
||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -44,6 +44,8 @@ public partial class AssistantBlock : ComponentBase, IMessageBusReceiver, IDispo
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(AssistantBlock);
|
||||
|
||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -525,10 +525,20 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
this.isStreaming = false;
|
||||
this.hasUnsavedChanges = false;
|
||||
this.userInput = string.Empty;
|
||||
this.currentWorkspaceId = this.ChatThread?.WorkspaceId ?? Guid.Empty;
|
||||
this.currentWorkspaceName = this.ChatThread is null ? string.Empty : await WorkspaceBehaviour.LoadWorkspaceName(this.ChatThread.WorkspaceId);
|
||||
this.WorkspaceName(this.currentWorkspaceName);
|
||||
|
||||
|
||||
if (this.ChatThread is not null)
|
||||
{
|
||||
this.currentWorkspaceId = this.ChatThread.WorkspaceId;
|
||||
this.currentWorkspaceName = await WorkspaceBehaviour.LoadWorkspaceName(this.ChatThread.WorkspaceId);
|
||||
this.WorkspaceName(this.currentWorkspaceName);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentWorkspaceId = Guid.Empty;
|
||||
this.currentWorkspaceName = string.Empty;
|
||||
this.WorkspaceName(this.currentWorkspaceName);
|
||||
}
|
||||
|
||||
await this.SelectProviderWhenLoadingChat();
|
||||
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
||||
{
|
||||
@@ -653,6 +663,8 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
public override string ComponentName => nameof(ChatComponent);
|
||||
|
||||
public override async Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
@@ -692,6 +704,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
this.MessageBus.Unregister(this);
|
||||
if(this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
|
||||
{
|
||||
await this.SaveThread();
|
||||
|
||||
@@ -63,6 +63,8 @@ public partial class ConfidenceInfo : ComponentBase, IMessageBusReceiver, IDispo
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(ConfidenceInfo);
|
||||
|
||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -57,6 +57,8 @@ public partial class ConfigurationBase : ComponentBase, IMessageBusReceiver, IDi
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(ConfigurationBase);
|
||||
|
||||
public Task ProcessMessage<TMsg>(ComponentBase? sendingComponent, Event triggeredEvent, TMsg? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -60,6 +60,8 @@ public partial class ConfigurationProviderSelection : ComponentBase, IMessageBus
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(ConfigurationProviderSelection);
|
||||
|
||||
public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -50,6 +50,8 @@ public partial class InnerScrolling : MSGComponentBase
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
public override string ComponentName => nameof(InnerScrolling);
|
||||
|
||||
public override Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -24,6 +24,8 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public abstract string ComponentName { get; }
|
||||
|
||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -136,6 +136,8 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, IDis
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(MainLayout);
|
||||
|
||||
public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -28,6 +28,8 @@ public partial class Chat : MSGComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.ApplyFilters([], [ Event.WORKSPACE_TOGGLE_OVERLAY ]);
|
||||
|
||||
this.splitterPosition = this.SettingsManager.ConfigurationData.Workspace.SplitterPosition;
|
||||
this.splitterSaveTimer.AutoReset = false;
|
||||
this.splitterSaveTimer.Elapsed += async (_, _) =>
|
||||
@@ -74,6 +76,8 @@ public partial class Chat : MSGComponentBase
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
public override string ComponentName => nameof(Chat);
|
||||
|
||||
public override Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -28,6 +28,8 @@ public partial class Settings : ComponentBase, IMessageBusReceiver, IDisposable
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(Settings);
|
||||
|
||||
public Task ProcessMessage<TMsg>(ComponentBase? sendingComponent, Event triggeredEvent, TMsg? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -41,6 +41,8 @@ public partial class Writer : MSGComponentBase, IAsyncDisposable
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
public override string ComponentName => nameof(Writer);
|
||||
|
||||
public override Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace AIStudio.Tools;
|
||||
|
||||
public interface IMessageBusReceiver
|
||||
{
|
||||
public string ComponentName { get; }
|
||||
|
||||
public Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data);
|
||||
|
||||
public Task<TResult?> ProcessMessageWithResult<TPayload, TResult>(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data);
|
||||
|
||||
@@ -60,6 +60,8 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
||||
|
||||
#region Implementation of IMessageBusReceiver
|
||||
|
||||
public string ComponentName => nameof(UpdateService);
|
||||
|
||||
public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# v0.9.27, build 202 (2025-01-xx xx:xx UTC)
|
||||
- Improved the inner content scrolling to use the entire space available.
|
||||
- Improved message process debugging. This helps to identify issues related to the message handling.
|
||||
- Fixed the hostname validation message for ERI v1 data sources.
|
||||
- Fixed a memory leak in the chat component.
|
||||
- Removed the "send to" button from the ERI server assistant, since it is not supported.
|
||||
Reference in new issue
Block a user