mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-07-04 06:42:56 +00:00
Improved secret input fields by adding a toggle visibility feature (#479)
This commit is contained in:
parent
e11c15dbab
commit
e3110820d2
@ -1015,6 +1015,12 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T3825586228"] = "Please p
|
|||||||
-- Show web content options
|
-- Show web content options
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Show web content options"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Show web content options"
|
||||||
|
|
||||||
|
-- Hide content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T1273315904"] = "Hide content"
|
||||||
|
|
||||||
|
-- Show content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T2891011873"] = "Show content"
|
||||||
|
|
||||||
-- Spellchecking is disabled
|
-- Spellchecking is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Spellchecking is disabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Spellchecking is disabled"
|
||||||
|
|
||||||
|
20
app/MindWork AI Studio/Components/SecretInputField.razor
Normal file
20
app/MindWork AI Studio/Components/SecretInputField.razor
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
@inherits MSGComponentBase
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center" Class="@this.Class" StretchItems="StretchItems.Start" Wrap="Wrap.NoWrap">
|
||||||
|
<MudTextField
|
||||||
|
T="string"
|
||||||
|
Text="@this.Secret"
|
||||||
|
TextChanged="@this.OnSecretChanged"
|
||||||
|
Label="@this.Label"
|
||||||
|
Placeholder="@this.Placeholder"
|
||||||
|
Adornment="Adornment.Start"
|
||||||
|
AdornmentIcon="@Icons.Material.Filled.VpnKey"
|
||||||
|
AdornmentColor="Color.Info"
|
||||||
|
InputType="@this.InputType"
|
||||||
|
Immediate="true"
|
||||||
|
Validation="@this.Validation"
|
||||||
|
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>
|
||||||
|
|
||||||
|
<MudTooltip Text="@this.ToggleVisibilityTooltip">
|
||||||
|
<MudIconButton Icon="@this.InputTypeIcon" OnClick="() => this.ToggleVisibility()"/>
|
||||||
|
</MudTooltip>
|
||||||
|
</MudStack>
|
54
app/MindWork AI Studio/Components/SecretInputField.razor.cs
Normal file
54
app/MindWork AI Studio/Components/SecretInputField.razor.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class SecretInputField : MSGComponentBase
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Secret { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<string> SecretChanged { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Label { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Placeholder { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<string, string?> Validation { get; set; } = _ => null;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Class { get; set; } = "mb-3";
|
||||||
|
|
||||||
|
#region Overrides of MSGComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
|
||||||
|
// Configure the spellchecking for the instance name input:
|
||||||
|
this.SettingsManager.InjectSpellchecking(SPELLCHECK_ATTRIBUTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private bool isSecretVisible;
|
||||||
|
|
||||||
|
private InputType InputType => this.isSecretVisible ? InputType.Text : InputType.Password;
|
||||||
|
|
||||||
|
private string InputTypeIcon => this.isSecretVisible ? Icons.Material.Filled.Visibility : Icons.Material.Filled.VisibilityOff;
|
||||||
|
|
||||||
|
private string ToggleVisibilityTooltip => this.isSecretVisible ? T("Hide content") : T("Show content");
|
||||||
|
|
||||||
|
private Task OnSecretChanged(string arg)
|
||||||
|
{
|
||||||
|
this.Secret = arg;
|
||||||
|
return this.SecretChanged.InvokeAsync(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleVisibility() => this.isSecretVisible = !this.isSecretVisible;
|
||||||
|
}
|
@ -96,20 +96,7 @@
|
|||||||
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>
|
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@* ReSharper disable once CSharpWarnings::CS8974 *@
|
<SecretInputField @bind-Secret="@this.dataSecret" Label="@this.GetSecretLabel()" Validation="@this.dataSourceValidation.ValidatingSecret" Class="mb-6"/>
|
||||||
<MudTextField
|
|
||||||
T="string"
|
|
||||||
@bind-Text="@this.dataSecret"
|
|
||||||
Label="@this.GetSecretLabel()"
|
|
||||||
Class="mb-6"
|
|
||||||
Immediate="@true"
|
|
||||||
Validation="@this.dataSourceValidation.ValidatingSecret"
|
|
||||||
Adornment="Adornment.Start"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.Security"
|
|
||||||
AdornmentColor="Color.Info"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
InputType="InputType.Password"
|
|
||||||
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (this.availableRetrievalProcesses.Count > 0)
|
@if (this.availableRetrievalProcesses.Count > 0)
|
||||||
|
@ -25,18 +25,7 @@
|
|||||||
|
|
||||||
@if (this.DataLLMProvider.IsAPIKeyNeeded(this.DataHost))
|
@if (this.DataLLMProvider.IsAPIKeyNeeded(this.DataHost))
|
||||||
{
|
{
|
||||||
@* ReSharper disable once CSharpWarnings::CS8974 *@
|
<SecretInputField @bind-Secret="@this.dataAPIKey" Label="@this.APIKeyText" Validation="@this.providerValidation.ValidatingAPIKey"/>
|
||||||
<MudTextField
|
|
||||||
T="string"
|
|
||||||
@bind-Text="@this.dataAPIKey"
|
|
||||||
Label="@this.APIKeyText"
|
|
||||||
Class="mb-3"
|
|
||||||
Adornment="Adornment.Start"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.VpnKey"
|
|
||||||
AdornmentColor="Color.Info"
|
|
||||||
InputType="InputType.Password"
|
|
||||||
Immediate="true"
|
|
||||||
Validation="@this.providerValidation.ValidatingAPIKey"/>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (this.DataLLMProvider.IsHostnameNeeded())
|
@if (this.DataLLMProvider.IsHostnameNeeded())
|
||||||
|
@ -22,18 +22,7 @@
|
|||||||
|
|
||||||
@if (this.DataLLMProvider.IsAPIKeyNeeded(this.DataHost))
|
@if (this.DataLLMProvider.IsAPIKeyNeeded(this.DataHost))
|
||||||
{
|
{
|
||||||
@* ReSharper disable once CSharpWarnings::CS8974 *@
|
<SecretInputField @bind-Secret="@this.dataAPIKey" Label="@this.APIKeyText" Validation="@this.providerValidation.ValidatingAPIKey"/>
|
||||||
<MudTextField
|
|
||||||
T="string"
|
|
||||||
@bind-Text="@this.dataAPIKey"
|
|
||||||
Label="@this.APIKeyText"
|
|
||||||
Class="mb-3"
|
|
||||||
Adornment="Adornment.Start"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.VpnKey"
|
|
||||||
AdornmentColor="Color.Info"
|
|
||||||
InputType="InputType.Password"
|
|
||||||
Immediate="true"
|
|
||||||
Validation="@this.providerValidation.ValidatingAPIKey"/>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (this.DataLLMProvider.IsHostnameNeeded())
|
@if (this.DataLLMProvider.IsHostnameNeeded())
|
||||||
|
@ -1017,6 +1017,12 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T3825586228"] = "Bitte ge
|
|||||||
-- Show web content options
|
-- Show web content options
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Web-Inhalte anzeigen"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Web-Inhalte anzeigen"
|
||||||
|
|
||||||
|
-- Hide content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T1273315904"] = "Inhalt ausblenden"
|
||||||
|
|
||||||
|
-- Show content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T2891011873"] = "Inhalt anzeigen"
|
||||||
|
|
||||||
-- Spellchecking is disabled
|
-- Spellchecking is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Rechtschreibprüfung ist deaktiviert"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Rechtschreibprüfung ist deaktiviert"
|
||||||
|
|
||||||
|
@ -1017,6 +1017,12 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T3825586228"] = "Please p
|
|||||||
-- Show web content options
|
-- Show web content options
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Show web content options"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::READWEBCONTENT::T4249712357"] = "Show web content options"
|
||||||
|
|
||||||
|
-- Hide content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T1273315904"] = "Hide content"
|
||||||
|
|
||||||
|
-- Show content
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SECRETINPUTFIELD::T2891011873"] = "Show content"
|
||||||
|
|
||||||
-- Spellchecking is disabled
|
-- Spellchecking is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Spellchecking is disabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T1059411425"] = "Spellchecking is disabled"
|
||||||
|
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
- Added chat templates. They are similar to common AI companies' playgrounds, where you can define your own system prompts and leverage assistant prompts for providers that support them. We thank Peer `peerschuett` for the work on this feature.
|
- Added chat templates. They are similar to common AI companies' playgrounds, where you can define your own system prompts and leverage assistant prompts for providers that support them. We thank Peer `peerschuett` for the work on this feature.
|
||||||
- Added Russian as a language option for various assistants (e.g., translations, text summarization).
|
- Added Russian as a language option for various assistants (e.g., translations, text summarization).
|
||||||
- Improved chat options: you can access them directly from the chat interface.
|
- Improved chat options: you can access them directly from the chat interface.
|
||||||
|
- Improved password and API key input fields: they now optionally display their content to allow users to verify manual input.
|
||||||
- Changed the design of the data source settings to match the new design.
|
- Changed the design of the data source settings to match the new design.
|
Loading…
Reference in New Issue
Block a user