mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-18 15:32:10 +00:00
67 lines
3.2 KiB
Plaintext
67 lines
3.2 KiB
Plaintext
@using AIStudio.Tools.ToolCallingSystem
|
|
@inherits SettingsDialogBase
|
|
|
|
<MudDialog>
|
|
<TitleContent>
|
|
<MudText Typo="Typo.h6" Class="d-flex align-center">
|
|
<MudIcon Icon="@this.implementation?.Icon" Class="mr-2" />
|
|
@(this.implementation?.GetDisplayName() ?? T("Tool Settings"))
|
|
</MudText>
|
|
</TitleContent>
|
|
<DialogContent>
|
|
@if (this.toolDefinition is null)
|
|
{
|
|
<MudText Typo="Typo.body1">@T("The selected tool could not be loaded.")</MudText>
|
|
}
|
|
else
|
|
{
|
|
<MudJustifiedText Typo="Typo.body1" Class="mb-4">
|
|
@this.implementation?.GetDescription()
|
|
</MudJustifiedText>
|
|
|
|
@if (!this.SettingsManager.IsToolActive(this.toolDefinition.Id))
|
|
{
|
|
<MudAlert Severity="Severity.Warning" Class="mb-4">@T("This tool has been disabled by your organization.")</MudAlert>
|
|
}
|
|
|
|
@if (!string.IsNullOrWhiteSpace(this.validationMessage))
|
|
{
|
|
<MudAlert Severity="Severity.Error" Class="mb-4">@this.validationMessage</MudAlert>
|
|
}
|
|
|
|
<MudPaper Class="pa-3 mb-4 border-dashed border rounded-lg">
|
|
@foreach (var property in this.toolDefinition.SettingsSchema.Properties)
|
|
{
|
|
var fieldName = property.Key;
|
|
var field = property.Value;
|
|
if (field.EnumValues.Count > 0)
|
|
{
|
|
<MudSelect T="string" Label="@this.GetFieldLabel(fieldName, field)" Value="@this.GetValue(fieldName)" ValueChanged="@(value => this.UpdateValue(fieldName, value))" Variant="Variant.Outlined" Margin="Margin.Dense" HelperText="@this.GetFieldDescription(fieldName, field)" Placeholder="@this.GetFieldPlaceholder(fieldName, field)" Class="mb-3" Disabled="@this.IsFieldDisabled(fieldName)">
|
|
@if (!this.toolDefinition.SettingsSchema.Required.Contains(fieldName))
|
|
{
|
|
<MudSelectItem T="string" Value="@string.Empty">@T("Not set")</MudSelectItem>
|
|
}
|
|
@foreach (var option in field.EnumValues)
|
|
{
|
|
<MudSelectItem T="string" Value="@option">@option</MudSelectItem>
|
|
}
|
|
</MudSelect>
|
|
}
|
|
else
|
|
{
|
|
<MudTextField T="string" Label="@this.GetFieldLabel(fieldName, field)" Value="@this.GetValue(fieldName)" ValueChanged="@(value => this.UpdateValue(fieldName, value))" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3" HelperText="@this.GetFieldDescription(fieldName, field)" Placeholder="@this.GetFieldPlaceholder(fieldName, field)" InputType="@(field.Secret ? InputType.Password : InputType.Text)" Disabled="@this.IsFieldDisabled(fieldName)" />
|
|
}
|
|
}
|
|
</MudPaper>
|
|
}
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="@this.Close" Variant="Variant.Text">
|
|
@T("Cancel")
|
|
</MudButton>
|
|
<MudButton OnClick="@this.Save" Variant="Variant.Filled" Disabled="@(this.toolDefinition is null)">
|
|
@T("Save")
|
|
</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|