mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 21:12:11 +00:00
Added session status indicators to assistant icons
This commit is contained in:
parent
7fec1d75ff
commit
8eebc94ca5
@ -7,7 +7,17 @@
|
||||
<MudCardHeader>
|
||||
<CardHeaderContent>
|
||||
<MudStack AlignItems="AlignItems.Center" Row="@true">
|
||||
<MudIcon Icon="@this.Icon" Size="Size.Large" Color="Color.Primary"/>
|
||||
<MudElement HtmlTag="span" Style="position: relative; display: inline-flex; line-height: 1;">
|
||||
<MudIcon Icon="@this.Icon" Size="Size.Large" Color="Color.Primary"/>
|
||||
@if (this.AssistantSessionIndicator is { } indicator)
|
||||
{
|
||||
<MudTooltip Text="@indicator.Tooltip">
|
||||
<MudElement HtmlTag="span" Style="position: absolute; right: -0.45rem; bottom: -0.3rem; display: inline-flex; background-color: var(--mud-palette-surface); border-radius: 50%; padding: 1px;">
|
||||
<MudIcon Icon="@indicator.Icon" Size="Size.Small" Color="@indicator.Color"/>
|
||||
</MudElement>
|
||||
</MudTooltip>
|
||||
}
|
||||
</MudElement>
|
||||
<MudText Typo="Typo.h6">
|
||||
@this.Name
|
||||
</MudText>
|
||||
|
||||
@ -8,6 +8,14 @@ namespace AIStudio.Components;
|
||||
|
||||
public partial class AssistantBlock<TSettings> : MSGComponentBase where TSettings : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the assistant session indicator shown on top of the assistant icon.
|
||||
/// </summary>
|
||||
/// <param name="Icon">The icon that communicates the session status.</param>
|
||||
/// <param name="Color">The color that communicates the session status.</param>
|
||||
/// <param name="Tooltip">The tooltip text that explains the session status.</param>
|
||||
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<TSettings> : MSGComponentBase where TSetting
|
||||
await this.DialogService.ShowAsync<TSettings>(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<TSettings> : MSGComponentBase where TSetting
|
||||
private bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this block represents an active assistant session.
|
||||
/// Gets the newest assistant session snapshot represented by this block.
|
||||
/// </summary>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assistant session indicator shown on top of the assistant icon.
|
||||
/// </summary>
|
||||
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,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the block when assistant session activity changes.
|
||||
|
||||
@ -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.
|
||||
Loading…
Reference in New Issue
Block a user