mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 15:41:37 +00:00
Added NoSettingsPanel option for assistants
This commit is contained in:
parent
a774623af8
commit
dac25c51c6
@ -9,7 +9,10 @@
|
|||||||
@this.Title
|
@this.Title
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
|
@if (this.HasSettingsPanel)
|
||||||
|
{
|
||||||
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="@(async () => await this.OpenSettingsDialog())"/>
|
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="@(async () => await this.OpenSettingsDialog())"/>
|
||||||
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<InnerScrolling>
|
<InnerScrolling>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using AIStudio.Chat;
|
using AIStudio.Chat;
|
||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
using AIStudio.Settings;
|
using AIStudio.Settings;
|
||||||
|
using AIStudio.Dialogs.Settings;
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
@ -82,6 +83,8 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
||||||
|
|
||||||
|
protected virtual bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
|
||||||
|
|
||||||
protected AIStudio.Settings.Provider providerSettings = Settings.Provider.NONE;
|
protected AIStudio.Settings.Provider providerSettings = Settings.Provider.NONE;
|
||||||
protected MudForm? form;
|
protected MudForm? form;
|
||||||
protected bool inputIsValid;
|
protected bool inputIsValid;
|
||||||
@ -310,6 +313,9 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
protected async Task OpenSettingsDialog()
|
protected async Task OpenSettingsDialog()
|
||||||
{
|
{
|
||||||
|
if (!this.HasSettingsPanel)
|
||||||
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters();
|
var dialogParameters = new DialogParameters();
|
||||||
await this.DialogService.ShowAsync<TSettings>(null, dialogParameters, DialogOptions.FULLSCREEN);
|
await this.DialogService.ShowAsync<TSettings>(null, dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,10 @@
|
|||||||
<MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@this.Icon" Color="Color.Default" Href="@this.Link">
|
<MudButton Size="Size.Large" Variant="Variant.Filled" StartIcon="@this.Icon" Color="Color.Default" Href="@this.Link">
|
||||||
@this.ButtonText
|
@this.ButtonText
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
@if (this.HasSettingsPanel)
|
||||||
|
{
|
||||||
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
|
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" Color="Color.Default" OnClick="@this.OpenSettingsDialog"/>
|
||||||
|
}
|
||||||
</MudButtonGroup>
|
</MudButtonGroup>
|
||||||
</MudCardActions>
|
</MudCardActions>
|
||||||
</MudCard>
|
</MudCard>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using AIStudio.Settings.DataModel;
|
using AIStudio.Settings.DataModel;
|
||||||
|
using AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ public partial class AssistantBlock<TSettings> : MSGComponentBase where TSetting
|
|||||||
|
|
||||||
private async Task OpenSettingsDialog()
|
private async Task OpenSettingsDialog()
|
||||||
{
|
{
|
||||||
|
if (!this.HasSettingsPanel)
|
||||||
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters();
|
var dialogParameters = new DialogParameters();
|
||||||
|
|
||||||
await this.DialogService.ShowAsync<TSettings>(T("Open Settings"), dialogParameters, DialogOptions.FULLSCREEN);
|
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 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 IsVisible => this.SettingsManager.IsAssistantVisible(this.Component, assistantName: this.Name, requiredPreviewFeature: this.RequiredPreviewFeature);
|
||||||
|
|
||||||
|
private bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
|
||||||
}
|
}
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
@namespace AIStudio.Dialogs.Settings
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user