Fixed assistant visibility in "Send to ..." menus

This commit is contained in:
Thorsten Sommer 2026-03-14 10:34:51 +01:00
parent 6178d80449
commit 29a4bdea1d
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 36 additions and 12 deletions

View File

@ -80,10 +80,10 @@
@if (!this.FooterButtons.Any(x => x.Type is ButtonTypes.SEND_TO))
{
@if (this.ShowSendTo)
@if (this.ShowSendTo && this.VisibleSendToAssistants.Count > 0)
{
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
@foreach (var assistant in this.VisibleSendToAssistants)
{
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, new()))">
@assistant.Name()
@ -112,14 +112,17 @@
break;
case SendToButton sendToButton:
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
{
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
@assistant.Name()
</MudMenuItem>
}
</MudMenu>
@if (this.VisibleSendToAssistants.Count > 0)
{
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
@foreach (var assistant in this.VisibleSendToAssistants)
{
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
@assistant.Name()
</MudMenuItem>
}
</MudMenu>
}
break;
}
}

View File

@ -105,6 +105,13 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
if (!this.SettingsManager.IsAssistantVisible(this.Component, assistantName: this.Title))
{
this.Logger.LogInformation("Assistant '{AssistantTitle}' is hidden. Redirecting to the assistants overview.", this.Title);
this.NavigationManager.NavigateTo(Routes.ASSISTANTS);
return;
}
this.formChangeTimer.AutoReset = false;
this.formChangeTimer.Elapsed += async (_, _) =>
@ -142,6 +149,11 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
private string TB(string fallbackEN) => this.T(fallbackEN, typeof(AssistantBase<TSettings>).Namespace, nameof(AssistantBase<TSettings>));
private string SubmitButtonStyle => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence ? this.providerSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).StyleBorder(this.SettingsManager) : string.Empty;
private IReadOnlyList<Tools.Components> VisibleSendToAssistants => Enum.GetValues<AIStudio.Tools.Components>()
.Where(this.CanSendToAssistant)
.OrderBy(component => component.Name().Length)
.ToArray();
protected string? ValidatingProvider(AIStudio.Settings.Provider provider)
{
@ -339,7 +351,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected Task SendToAssistant(Tools.Components destination, SendToButton sendToButton)
{
if (!destination.AllowSendTo())
if (!this.CanSendToAssistant(destination))
return Task.CompletedTask;
var contentToSend = sendToButton == default ? string.Empty : sendToButton.UseResultingContentBlockData switch
@ -369,6 +381,14 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
this.NavigationManager.NavigateTo(sendToData.Route);
return Task.CompletedTask;
}
private bool CanSendToAssistant(Tools.Components component)
{
if (!component.AllowSendTo())
return false;
return this.SettingsManager.IsAssistantVisible(component, withLogging: false);
}
private async Task InnerResetForm()
{

View File

@ -9,4 +9,5 @@
- Improved the logbook reliability by significantly reducing duplicate log entries.
- Improved file attachments in chats: configuration and project files such as `Dockerfile`, `Caddyfile`, `Makefile`, or `Jenkinsfile` are now included more reliably when you send them to the AI.
- Improved the validation of additional API parameters in the advanced provider settings to help catch formatting mistakes earlier.
- Fixed an issue where the app could turn white or appear invisible in certain chats after HTML-like content was shown. Thanks Inga for reporting this issue and providing some context on how to reproduce it.
- Fixed an issue where assistants hidden via configuration plugins still appear in "Send to ..." menus. Thanks, Gunnar, for reporting this issue.
- Fixed an issue where the app could turn white or appear invisible in certain chats after HTML-like content was shown. Thanks, Inga, for reporting this issue and providing some context on how to reproduce it.