diff --git a/app/MindWork AI Studio/Components/AssistantBlock.razor b/app/MindWork AI Studio/Components/AssistantBlock.razor index 973af871..b46711c5 100644 --- a/app/MindWork AI Studio/Components/AssistantBlock.razor +++ b/app/MindWork AI Studio/Components/AssistantBlock.razor @@ -7,7 +7,17 @@ - + + + @if (this.AssistantSessionIndicator is { } indicator) + { + + + + + + } + @this.Name diff --git a/app/MindWork AI Studio/Components/AssistantBlock.razor.cs b/app/MindWork AI Studio/Components/AssistantBlock.razor.cs index 741fc836..267607fd 100644 --- a/app/MindWork AI Studio/Components/AssistantBlock.razor.cs +++ b/app/MindWork AI Studio/Components/AssistantBlock.razor.cs @@ -8,6 +8,14 @@ namespace AIStudio.Components; public partial class AssistantBlock : MSGComponentBase where TSettings : IComponent { + /// + /// Describes the assistant session indicator shown on top of the assistant icon. + /// + /// The icon that communicates the session status. + /// The color that communicates the session status. + /// The tooltip text that explains the session status. + private sealed record AssistantSessionIndicatorData(string Icon, Color Color, string Tooltip); + [Parameter] public string Name { get; set; } = string.Empty; @@ -60,7 +68,7 @@ public partial class AssistantBlock : MSGComponentBase where TSetting await this.DialogService.ShowAsync(T("Open Settings"), dialogParameters, DialogOptions.FULLSCREEN); } - private string BorderColor => this.HasActiveSession ? this.ColorTheme.GetActivityIndicatorColor(this.SettingsManager) : this.SettingsManager.IsDarkMode switch + private string BorderColor => this.AssistantSessionSnapshot?.IsActive is true ? this.ColorTheme.GetActivityIndicatorColor(this.SettingsManager) : this.SettingsManager.IsDarkMode switch { true => this.ColorTheme.GetCurrentPalette(this.SettingsManager).GrayDefault, false => this.ColorTheme.GetCurrentPalette(this.SettingsManager).GrayDefault, @@ -73,11 +81,23 @@ public partial class AssistantBlock : MSGComponentBase where TSetting private bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel); /// - /// Gets whether this block represents an active assistant session. + /// Gets the newest assistant session snapshot represented by this block. /// - private bool HasActiveSession => string.IsNullOrWhiteSpace(this.AssistantSessionInstanceId) - ? this.AssistantSessionService.GetSnapshots().Any(snapshot => snapshot.IsActive && snapshot.Key.Component == this.Component) - : this.AssistantSessionService.GetSnapshots().Any(snapshot => snapshot.IsActive && snapshot.Key.InstanceId == this.AssistantSessionInstanceId); + private AssistantSessionSnapshot? AssistantSessionSnapshot => string.IsNullOrWhiteSpace(this.AssistantSessionInstanceId) + ? this.AssistantSessionService.GetSnapshots().FirstOrDefault(snapshot => snapshot.Key.Component == this.Component) + : this.AssistantSessionService.GetSnapshots().FirstOrDefault(snapshot => snapshot.Key.InstanceId == this.AssistantSessionInstanceId); + + /// + /// Gets the assistant session indicator shown on top of the assistant icon. + /// + private AssistantSessionIndicatorData? AssistantSessionIndicator => this.AssistantSessionSnapshot?.Status switch + { + AssistantSessionStatus.RUNNING or AssistantSessionStatus.CANCELING => new(Icons.Material.Filled.ChangeCircle, Color.Info, this.T("Assistant is still running.")), + AssistantSessionStatus.COMPLETED => new(Icons.Material.Filled.TaskAlt, Color.Success, this.T("Result is ready.")), + AssistantSessionStatus.FAILED => new(Icons.Material.Filled.Error, Color.Error, this.T("Assistant failed. Open it to review the result.")), + AssistantSessionStatus.CANCELED => new(Icons.Material.Filled.Cancel, Color.Warning, this.T("Assistant was canceled. Open it to review the result.")), + _ => null, + }; /// /// Refreshes the block when assistant session activity changes. diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.6.3.md b/app/MindWork AI Studio/wwwroot/changelog/v26.6.3.md index d7662a38..9a812f05 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.6.3.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.6.3.md @@ -1,4 +1,5 @@ # v26.6.3, build 243 (2026-06-xx xx:xx UTC) - Improved assistants so running tasks can continue when you leave the assistant and return later. +- Improved the assistants overview so it shows which assistants are still running or have a result ready. - Improved the activity indicators for running chats and assistants so they use a consistent blue highlight. - Improved the chat experience by automatically focusing the message composer again when it becomes available. Thanks, Dominic Neuburg (`donework`), for the contribution. \ No newline at end of file