mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-03-29 15:51:39 +00:00
Fixed assistant visibility in "Send to ..." menus
This commit is contained in:
parent
6178d80449
commit
29a4bdea1d
@ -80,10 +80,10 @@
|
|||||||
|
|
||||||
@if (!this.FooterButtons.Any(x => x.Type is ButtonTypes.SEND_TO))
|
@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">
|
<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()))">
|
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, new()))">
|
||||||
@assistant.Name()
|
@assistant.Name()
|
||||||
@ -112,14 +112,17 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SendToButton sendToButton:
|
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">
|
@if (this.VisibleSendToAssistants.Count > 0)
|
||||||
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
|
{
|
||||||
{
|
<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">
|
||||||
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
|
@foreach (var assistant in this.VisibleSendToAssistants)
|
||||||
@assistant.Name()
|
{
|
||||||
</MudMenuItem>
|
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
|
||||||
}
|
@assistant.Name()
|
||||||
</MudMenu>
|
</MudMenuItem>
|
||||||
|
}
|
||||||
|
</MudMenu>
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,6 +105,13 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await base.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.AutoReset = false;
|
||||||
this.formChangeTimer.Elapsed += async (_, _) =>
|
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 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 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)
|
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)
|
protected Task SendToAssistant(Tools.Components destination, SendToButton sendToButton)
|
||||||
{
|
{
|
||||||
if (!destination.AllowSendTo())
|
if (!this.CanSendToAssistant(destination))
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
var contentToSend = sendToButton == default ? string.Empty : sendToButton.UseResultingContentBlockData switch
|
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);
|
this.NavigationManager.NavigateTo(sendToData.Route);
|
||||||
return Task.CompletedTask;
|
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()
|
private async Task InnerResetForm()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,4 +9,5 @@
|
|||||||
- Improved the logbook reliability by significantly reducing duplicate log entries.
|
- 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 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.
|
- 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.
|
||||||
Loading…
Reference in New Issue
Block a user