Added NoSettingsPanel option for assistants

This commit is contained in:
Thorsten Sommer 2026-01-28 09:45:41 +01:00
parent a774623af8
commit dac25c51c6
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
5 changed files with 26 additions and 6 deletions

View File

@ -9,7 +9,10 @@
@this.Title
</MudText>
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="@(async () => await this.OpenSettingsDialog())"/>
@if (this.HasSettingsPanel)
{
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="@(async () => await this.OpenSettingsDialog())"/>
}
</MudStack>
<InnerScrolling>
@ -145,4 +148,4 @@
</MudStack>
</FooterContent>
</InnerScrolling>
</div>
</div>

View File

@ -1,6 +1,7 @@
using AIStudio.Chat;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Dialogs.Settings;
using AIStudio.Tools.Services;
using Microsoft.AspNetCore.Components;
@ -81,6 +82,8 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected virtual ChatThread ConvertToChatThread => this.chatThread ?? new();
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
protected virtual bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
protected AIStudio.Settings.Provider providerSettings = Settings.Provider.NONE;
protected MudForm? form;
@ -310,6 +313,9 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected async Task OpenSettingsDialog()
{
if (!this.HasSettingsPanel)
return;
var dialogParameters = new DialogParameters();
await this.DialogService.ShowAsync<TSettings>(null, dialogParameters, DialogOptions.FULLSCREEN);
}
@ -398,4 +404,4 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
}
#endregion
}
}

View File

@ -26,8 +26,11 @@
<MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@this.Icon" Color="Color.Default" Href="@this.Link">
@this.ButtonText
</MudButton>
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
@if (this.HasSettingsPanel)
{
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
}
</MudButtonGroup>
</MudCardActions>
</MudCard>
}
}

View File

@ -1,4 +1,5 @@
using AIStudio.Settings.DataModel;
using AIStudio.Dialogs.Settings;
using Microsoft.AspNetCore.Components;
@ -37,6 +38,9 @@ public partial class AssistantBlock<TSettings> : MSGComponentBase where TSetting
private async Task OpenSettingsDialog()
{
if (!this.HasSettingsPanel)
return;
var dialogParameters = new DialogParameters();
await this.DialogService.ShowAsync<TSettings>(T("Open Settings"), dialogParameters, DialogOptions.FULLSCREEN);
@ -51,4 +55,6 @@ public partial class AssistantBlock<TSettings> : MSGComponentBase where TSetting
private string BlockStyle => $"border-width: 2px; border-color: {this.BorderColor}; border-radius: 12px; border-style: solid; max-width: 20em;";
private bool IsVisible => this.SettingsManager.IsAssistantVisible(this.Component, assistantName: this.Name, requiredPreviewFeature: this.RequiredPreviewFeature);
}
private bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
}

View File

@ -0,0 +1,2 @@
@namespace AIStudio.Dialogs.Settings