Upgraded to MudBlazor 9 (#1137)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-31 10:48:20 +01:00
1 parent e0337a99bc
commit aeba1fbccc
625 files changed
+408 -882

No files matched your search

@@ -6,7 +6,7 @@
@T("Review the assistant draft before AI Studio generates the Lua plugin. You can edit the Markdown draft if something should be changed.")
</MudJustifiedText>
<MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" PanelClass="pa-2" Class="mb-2">
<MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" TabPanelsClass="pa-2" Class="mb-2">
<MudTabPanel Text="@T("Preview")" Icon="@Icons.Material.Filled.Article">
<MudField Variant="Variant.Outlined" AdornmentIcon="@Icons.Material.Filled.Visibility" Adornment="Adornment.Start" Label="@T("Assistant draft")" FullWidth="true" Class="ma-2 pe-4">
<div style="max-height: 58vh; overflow-y: auto;">
@@ -15,7 +15,7 @@
</MudField>
</MudTabPanel>
<MudTabPanel Text="@T("Edit")" Icon="@Icons.Material.Filled.Edit">
<MudTextField T="string" @bind-Text="@this.DraftMarkdown" AdornmentIcon="@Icons.Material.Filled.EditNote" Adornment="Adornment.Start" Label="@T("Assistant draft Markdown")" Variant="Variant.Outlined" Lines="16" AutoGrow="@true" MaxLines="32" Class="ma-2"/>
<MudTextField T="string" @bind-Text="@this.DraftMarkdown" AdornmentIcon="@Icons.Material.Filled.EditNote" Adornment="Adornment.Start" Label="@T("Assistant draft Markdown")" Variant="Variant.Outlined" Lines="16" Sizing="InputSizing.Auto" MaxLines="32" Class="ma-2"/>
</MudTabPanel>
</MudTabs>
</DialogContent>
@@ -25,7 +25,7 @@
Placeholder="@T("Add a field for the target audience and make the final answer shorter.")"
Variant="Variant.Outlined"
Lines="5"
AutoGrow="true"
Sizing="InputSizing.Auto"
MaxLines="12"
Immediate="true"
Disabled="@(this.isGenerating || this.isApplying)" />
@@ -50,7 +50,7 @@
Variant="Variant.Outlined"
Lines="6"
MaxLines="12"
AutoGrow="@true"
Sizing="InputSizing.Auto"
Class="mb-3"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
HelperText="@T("Tell the AI your system prompt.")"
@@ -81,7 +81,7 @@
Variant="Variant.Outlined"
Lines="4"
MaxLines="12"
AutoGrow="@true"
Sizing="InputSizing.Auto"
Class="mb-3"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
HelperText="@T("Tell the AI your predefined user input.")"
@@ -259,7 +259,7 @@
@switch(context.Content)
{
case ContentText textContent:
<MudTextField AutoGrow="true" Value="@textContent.Text" Placeholder="@T("Enter a message")" ReadOnly="true" Variant="Variant.Text" Validation="@this.ValidateExampleTextMessage"/>
<MudTextField Sizing="InputSizing.Auto" Value="@textContent.Text" Placeholder="@T("Enter a message")" ReadOnly="true" Variant="Variant.Text" Validation="@this.ValidateExampleTextMessage"/>
break;
case ContentImage { SourceType: ContentImageSource.URL or ContentImageSource.LOCAL_PATH } imageContent:
@@ -305,7 +305,7 @@
@switch(context.Content)
{
case ContentText textContent:
<MudTextField AutoGrow="true" @bind-Value="@textContent.Text" Label="@T("The message")" Required="true" Immediate="true" Placeholder="@T("Enter a message")" ReadOnly="@this.IsReadOnly"/>
<MudTextField Sizing="InputSizing.Auto" @bind-Value="@textContent.Text" Label="@T("The message")" Required="true" Immediate="true" Placeholder="@T("Enter a message")" ReadOnly="@this.IsReadOnly"/>
break;
default:
@@ -195,7 +195,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -403,7 +403,7 @@ public partial class ChatTemplateDialog : MSGComponentBase
}
}
await this.form.Validate();
await this.form.ValidateAsync();
// When the data is not valid, we don't store it:
if (!this.dataIsValid)
@@ -5,7 +5,7 @@
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
@T("Paste a configuration which was exported from AI Studio, for example by a colleague. AI Studio only reads its values and never runs the pasted text. You can review and change everything afterward.")
</MudJustifiedText>
<MudTextField T="string" Text="@this.snippet" TextChanged="@this.SnippetChanged" Immediate="true" Label="@T("Exported configuration")" Lines="6" AutoGrow="true" MaxLines="14" Variant="Variant.Outlined" />
<MudTextField T="string" Text="@this.snippet" TextChanged="@this.SnippetChanged" Immediate="true" Label="@T("Exported configuration")" Lines="6" Sizing="InputSizing.Auto" MaxLines="14" Variant="Variant.Outlined" />
@if (!string.IsNullOrWhiteSpace(this.issue))
{
<MudAlert Severity="Severity.Error" Class="mt-3">@this.issue</MudAlert>
@@ -28,10 +28,10 @@ public partial class ConfigurationSnippetImportDialog : MSGComponentBase
/// </summary>
private ConfigurationSnippetImportResult? importWithHints;
private void SnippetChanged(string text)
private void SnippetChanged(string? text)
{
// The issue and the hints belong to the snippet they were found in:
this.snippet = text;
this.snippet = text ?? string.Empty;
this.issue = string.Empty;
this.importWithHints = null;
}
@@ -147,7 +147,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
{
this.dataSecret = string.Empty;
this.dataSecretStorageIssue = string.Format(T("Failed to load the auth. secret from the operating system. The message was: {0}. You might ignore this message and provide the secret again."), requestedSecret.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -172,7 +172,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -249,7 +249,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
using var client = ERIClientFactory.Get(ERIVersion.V1, this.DataSource);
if(client is null)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = T("Failed to connect to the ERI v1 server. The server is not supported.");
@@ -259,7 +259,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
var authSchemes = await client.GetAuthMethodsAsync(cts.Token);
if (!authSchemes.Successful)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = authSchemes.Message;
@@ -271,7 +271,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
var loginResult = await client.AuthenticateAsync(this.RustService, this.dataSecret, cts.Token);
if (!loginResult.Successful)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = loginResult.Message;
@@ -281,7 +281,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
var securityRequirementsRequest = await client.GetSecurityRequirementsAsync(cts.Token);
if (!securityRequirementsRequest.Successful)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = securityRequirementsRequest.Message;
@@ -293,7 +293,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
var retrievalInfoRequest = await client.GetRetrievalInfoAsync(cts.Token);
if (!retrievalInfoRequest.Successful)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = retrievalInfoRequest.Message;
@@ -324,7 +324,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
}
catch (Exception e)
{
await this.form.Validate();
await this.form.ValidateAsync();
Array.Resize(ref this.dataIssues, this.dataIssues.Length + 1);
this.dataIssues[^1] = string.Format(T("Failed to connect to the ERI v1 server. The message was: {0}"), e.Message);
@@ -370,7 +370,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
private async Task Store()
{
await this.form.Validate();
await this.form.ValidateAsync();
var testConnectionValidation = this.dataSourceValidation.ValidateTestedConnection();
if(testConnectionValidation is not null)
@@ -394,7 +394,7 @@ public partial class DataSourceERI_V1Dialog : MSGComponentBase, ISecretId
if (!storeResponse.Success)
{
this.dataSecretStorageIssue = string.Format(T("Failed to store the auth. secret in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -86,7 +86,7 @@
Variant="Variant.Outlined"
Margin="Margin.Dense"
Lines="1"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="@FilePatternSelection.MAX_FIELD_LINES"
Class="pattern-text-field"
/>
@@ -133,7 +133,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
// A check asked for in code waits until the fields hold their new values, cf. ToggleExpertSettings:
if (this.revalidateAfterRender)
@@ -267,7 +267,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
private async Task Store()
{
await this.form.Validate();
await this.form.ValidateAsync();
// When the data is not valid, we don't store it:
if (!this.dataIsValid)
@@ -124,7 +124,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
// A check asked for in code waits until the fields hold their new values, cf. ToggleExpertSettings:
if (this.revalidateAfterRender)
@@ -251,7 +251,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
private async Task Store()
{
await this.form.Validate();
await this.form.ValidateAsync();
// When the data is not valid, we don't store it:
if (!this.dataIsValid)
@@ -207,7 +207,7 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if (!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
// A check asked for in code waits until the fields hold their new values, cf. ToggleExpertSettings:
if (this.revalidateAfterRender)
@@ -469,7 +469,7 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
this.SelectProvider(GetProviderKey(this.organizationProviders[0]));
}
private void SelectProvider(string providerKey)
private void SelectProvider(string? providerKey)
{
this.selectedOrganizationProvider = this.organizationProviders.FirstOrDefault(candidate => GetProviderKey(candidate) == providerKey);
this.selectedTemplate = MailboxProviderTemplates.ALL.FirstOrDefault(candidate => GetProviderKey(candidate) == providerKey);
@@ -538,7 +538,7 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
}
await this.RecordSignInOutcomeAsync(settings, this.testFailure, serverAnswer);
await this.form.Validate();
await this.form.ValidateAsync();
}
private async Task<MailServerFolder?> CreateFolder(string parentFullName, string name)
@@ -618,7 +618,7 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
if (this.IsAddingNotAllowed)
return;
await this.form.Validate();
await this.form.ValidateAsync();
if (this.RequiresConnectionTest && this.dataSourceValidation.ValidateTestedConnection() is { } testIssue)
{
@@ -654,7 +654,7 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
if (!storeResponse.Success)
{
this.dataSecretStorageIssue = string.Format(T("Failed to store the password in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
}
@@ -26,7 +26,7 @@
<MudPaper Class="pa-3 border-dashed border rounded-lg">
<MudTextField T="string" @bind-Text="@this.pluginName" Validation="@this.ValidatePluginName" AdornmentIcon="@Icons.Material.Filled.Extension" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Plugin name")" HelperText="@T("The name shown on the plugins page.")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3" Disabled="@this.IsBusy"/>
<MudTextField T="string" @bind-Text="@this.title" Validation="@this.ValidateTitle" AdornmentIcon="@Icons.Material.Filled.Assistant" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Tile title")" HelperText="@T("The title shown on the tile.")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3" Disabled="@this.IsBusy"/>
<MudTextField T="string" @bind-Text="@this.description" Validation="@this.ValidateDescription" AdornmentIcon="@Icons.Material.Filled.Notes" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Description")" HelperText="@T("Shown on the tile and on the plugins page.")" Variant="Variant.Outlined" Margin="Margin.Dense" Lines="2" AutoGrow="@true" MaxLines="6" Class="mb-3" Disabled="@this.IsBusy"/>
<MudTextField T="string" @bind-Text="@this.description" Validation="@this.ValidateDescription" AdornmentIcon="@Icons.Material.Filled.Notes" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Description")" HelperText="@T("Shown on the tile and on the plugins page.")" Variant="Variant.Outlined" Margin="Margin.Dense" Lines="2" Sizing="InputSizing.Auto" MaxLines="6" Class="mb-3" Disabled="@this.IsBusy"/>
<DirectChatLauncherForm @bind-WorkspaceName="@this.workspaceName"
@bind-ProviderId="@this.providerId"
@bind-ProfileId="@this.profileId"
@@ -47,7 +47,7 @@ public partial class DirectChatLauncherSettingsDialog : MSGComponentBase
private string providerId = string.Empty;
private string profileId = string.Empty;
private string chatTemplateId = string.Empty;
private IEnumerable<string> dataSourceIds = [];
private IReadOnlyCollection<string> dataSourceIds = [];
private HashSet<string> toolIds = [];
private string issue = string.Empty;
private bool canEdit;
@@ -170,7 +170,7 @@ public partial class DirectChatLauncherSettingsDialog : MSGComponentBase
if (!this.CanSave || this.assistantPlugin is null || this.availablePlugin is null || this.form is null)
return;
await this.form.Validate();
await this.form.ValidateAsync();
if (!this.form.IsValid)
return;
@@ -48,7 +48,7 @@
Label="@T("Embedding Description")"
HelperText="@T("A short description of the embedding method.")"
Lines="3"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="6"
Immediate="@true"
Variant="Variant.Outlined"
@@ -67,7 +67,7 @@
Label="@T("Used when")"
HelperText="@T("When is this embedding used? When you define multiple embeddings, it is helpful to know when to use which one.")"
Lines="3"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="6"
Immediate="@true"
Variant="Variant.Outlined"
@@ -77,7 +77,7 @@ public partial class EmbeddingMethodDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -127,7 +127,7 @@ public partial class EmbeddingMethodDialog : MSGComponentBase
private async Task Store()
{
await this.form.Validate();
await this.form.ValidateAsync();
// When the data is not valid, we don't store it:
if (!this.dataIsValid)
@@ -251,7 +251,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
if (this.DataLLMProvider is not LLMProviders.SELF_HOSTED && !this.IsEnterpriseConfiguration)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to load the API key from the operating system. The message was: {0}. You might ignore this message and provide the API key again."), requestedSecret.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -272,7 +272,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -298,7 +298,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
this.dataStoreWasAttempted = true;
await this.dataTokenizerValidationTask;
await this.form.Validate();
await this.form.ValidateAsync();
this.dataAPIKeyStorageIssue = string.Empty;
// Manually validate the model selection (needed when no models are loaded
@@ -343,7 +343,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
if (!response.Success)
{
this.dataCustomTokenizerValidationIssue = string.IsNullOrWhiteSpace(response.Message) ? string.Empty : response.Message;
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
this.dataFilePath = response.StoredPath;
@@ -358,7 +358,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
if (!storeResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to store the API key in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -372,7 +372,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
if (!deleteResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to remove the API key from the operating system. The message was: {0}. Please try again."), deleteResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -406,7 +406,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
if (!string.IsNullOrWhiteSpace(this.dataAPIKeyStorageIssue))
{
this.dataAPIKeyStorageIssue = string.Empty;
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -457,8 +457,9 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
await this.MessageBus.SendWarning(new(Icons.Material.Filled.Warning, T("Please drop a tokenizer file in the JSON format.")));
}
private async Task OnDataFilePathChanged(string filePath)
private async Task OnDataFilePathChanged(string? changedFilePath)
{
var filePath = changedFilePath ?? string.Empty;
this.dataFilePath = filePath;
var validationRevision = ++this.dataTokenizerValidationRevision;
this.dataTokenizerValidationTask = this.ValidateCustomTokenizer(filePath, validationRevision);
@@ -477,9 +478,9 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
this.dataTokenizerFingerprint = tokenizerFingerprint;
if (this.dataStoreWasAttempted)
await this.form.Validate();
await this.form.ValidateAsync();
else
this.form.ResetValidation();
await this.form.ResetValidationAsync();
}
private async Task ValidateCustomTokenizer(string filePath, int validationRevision)
@@ -7,7 +7,7 @@
Text="@this.ResultText"
Variant="Variant.Outlined"
Lines="10"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="25"
ReadOnly="true"
Label="@this.ResultLabelText"
@@ -41,7 +41,7 @@
Label="@T("What should the AI know about you?")"
Variant="Variant.Outlined"
Lines="6"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="12"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
HelperText="@T("Tell the AI something about yourself. What is your profession? How experienced are you in this profession? Which technologies do you like?")"
@@ -59,7 +59,7 @@
Label="@T("What should the AI do for you?")"
Variant="Variant.Outlined"
Lines="6"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="12"
Class="mt-10"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
@@ -102,7 +102,7 @@ public partial class ProfileDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -114,7 +114,7 @@ public partial class ProfileDialog : MSGComponentBase
if (this.IsReadOnly)
return;
await this.form.Validate();
await this.form.ValidateAsync();
// When the data is not valid, we don't store it:
if (!this.dataIsValid)
@@ -311,7 +311,7 @@
<MudJustifiedText Typo="Typo.body2" Class="mb-4">
@string.Format(T("The current model uses the {0}."), this.GetCurrentModelApiLabel())
</MudJustifiedText>
<MudTextField T="string" Label=@T("Additional API parameters") Variant="Variant.Outlined" Lines="4" AutoGrow="true" MaxLines="10" HelperText=@T("""Add the parameters in proper JSON formatting, e.g., "temperature": 0.5. Remove trailing commas. The usual surrounding curly brackets {} must not be used, though.""") Placeholder="@GetPlaceholderExpertSettings" @bind-Value="@this.AdditionalJsonApiParameters" Immediate="true" Disabled="@this.IsEnterpriseConfiguration" Validation="@this.ValidateAdditionalJsonApiParameters" OnBlur="@this.OnInputChangeExpertSettings"/>
<MudTextField T="string" Label=@T("Additional API parameters") Variant="Variant.Outlined" Lines="4" Sizing="InputSizing.Auto" MaxLines="10" HelperText=@T("""Add the parameters in proper JSON formatting, e.g., "temperature": 0.5. Remove trailing commas. The usual surrounding curly brackets {} must not be used, though.""") Placeholder="@GetPlaceholderExpertSettings" @bind-Value="@this.AdditionalJsonApiParameters" Immediate="true" Disabled="@this.IsEnterpriseConfiguration" Validation="@this.ValidateAdditionalJsonApiParameters" OnBlur="@this.OnInputChangeExpertSettings"/>
@if (this.ShowTokenizerSettings)
{
<MudJustifiedText Typo="Typo.body1" Class="mt-4 mb-3">
@@ -300,7 +300,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
if (this.DataLLMProvider is not LLMProviders.SELF_HOSTED && !this.IsEnterpriseConfiguration)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to load the API key from the operating system. The message was: {0}. You might ignore this message and provide the API key again."), requestedSecret.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -321,7 +321,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -347,7 +347,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
this.dataStoreWasAttempted = true;
await this.dataTokenizerValidationTask;
await this.form.Validate();
await this.form.ValidateAsync();
if (!string.IsNullOrWhiteSpace(this.dataAPIKeyStorageIssue))
this.dataAPIKeyStorageIssue = string.Empty;
@@ -376,7 +376,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
if (!string.IsNullOrWhiteSpace(this.dataFilePath))
{
this.dataCustomTokenizerValidationIssue = tokenizerResponse.Message;
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -395,7 +395,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
if (!storeResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to store the API key in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -409,7 +409,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
if (!deleteResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to remove the API key from the operating system. The message was: {0}. Please try again."), deleteResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -435,7 +435,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
if (!string.IsNullOrWhiteSpace(this.dataAPIKeyStorageIssue))
{
this.dataAPIKeyStorageIssue = string.Empty;
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -486,8 +486,9 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
await this.MessageBus.SendWarning(new(Icons.Material.Filled.Warning, T("Please drop a tokenizer file in the JSON format.")));
}
private async Task OnDataFilePathChanged(string filePath)
private async Task OnDataFilePathChanged(string? changedFilePath)
{
var filePath = changedFilePath ?? string.Empty;
this.dataFilePath = filePath;
var validationRevision = ++this.dataTokenizerValidationRevision;
this.dataTokenizerValidationTask = this.ValidateCustomTokenizer(filePath, validationRevision);
@@ -497,9 +498,9 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
return;
if (this.dataStoreWasAttempted)
await this.form.Validate();
await this.form.ValidateAsync();
else
this.form.ResetValidation();
await this.form.ResetValidationAsync();
}
private async Task ValidateCustomTokenizer(string filePath, int validationRevision)
@@ -38,7 +38,7 @@
Label="@T("Retrieval Process Description")"
HelperText="@T("A short description of the retrieval process.")"
Lines="3"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="6"
Immediate="@true"
Variant="Variant.Outlined"
@@ -132,7 +132,7 @@
Label="@T("Parameter Description")"
HelperText="@T("A short description of the parameter. What data type is it? What is it used for? What are the possible values?")"
Lines="3"
AutoGrow="@true"
Sizing="InputSizing.Auto"
MaxLines="6"
Immediate="@true"
Variant="Variant.Outlined"
@@ -91,7 +91,7 @@ public partial class RetrievalProcessDialog : MSGComponentBase
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -187,7 +187,7 @@ public partial class RetrievalProcessDialog : MSGComponentBase
private async Task Store()
{
await this.form.Validate();
await this.form.ValidateAsync();
foreach (var parameter in this.retrievalParameters)
{
if (this.ValidateParameter(parameter) is { } issue)
@@ -217,7 +217,7 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase
{
if (!chatTemplate.TryExportAsConfigurationSection(out var luaCode, out var issue))
{
await this.DialogService.ShowMessageBox(
await this.DialogService.ShowMessageBoxAsync(
T("Export Chat Template"),
issue,
T("Close"));
@@ -232,7 +232,7 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase
{
if (!chatTemplate.TryExportAsConfigurationSectionWithPackagedAttachments(pluginDirectory, out var luaCode, out var issue))
{
await this.DialogService.ShowMessageBox(
await this.DialogService.ShowMessageBoxAsync(
T("Export Chat Template"),
issue,
T("Close"));
@@ -17,7 +17,6 @@
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Keyboard"
Immediate="@true"
TextUpdateSuppression="false"
OnKeyDown="@this.HandleKeyDown"
OnBlur="@this.HandleBlur"
UserAttributes="@USER_INPUT_ATTRIBUTES"
@@ -8,7 +8,7 @@
<MudTextField T="string"
@bind-Text="@this.UserInput"
Variant="Variant.Outlined"
AutoGrow="@false"
Sizing="InputSizing.Fixed"
Lines="1"
Label="@this.GetInputHeaderText"
AutoFocus="@true"
@@ -76,7 +76,7 @@ public partial class SingleInputDialog : MSGComponentBase
private async Task Confirm()
{
await this.form.Validate();
await this.form.ValidateAsync();
if(!this.form.IsValid)
return;
@@ -206,7 +206,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
if (this.DataLLMProvider is not LLMProviders.SELF_HOSTED && !this.IsEnterpriseConfiguration)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to load the API key from the operating system. The message was: {0}. You might ignore this message and provide the API key again."), requestedSecret.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -227,7 +227,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
// Reset the validation when not editing and on the first render.
// We don't want to show validation errors when the user opens the dialog.
if(!this.IsEditing && firstRender)
this.form.ResetValidation();
await this.form.ResetValidationAsync();
await base.OnAfterRenderAsync(firstRender);
}
@@ -251,7 +251,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
if (this.IsProviderProhibited)
return;
await this.form.Validate();
await this.form.ValidateAsync();
this.dataAPIKeyStorageIssue = string.Empty;
// Manually validate the model selection (needed when no models are loaded
@@ -277,7 +277,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
if (!storeResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to store the API key in the operating system. The message was: {0}. Please try again."), storeResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -291,7 +291,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
if (!deleteResponse.Success)
{
this.dataAPIKeyStorageIssue = string.Format(T("Failed to remove the API key from the operating system. The message was: {0}. Please try again."), deleteResponse.Issue);
await this.form.Validate();
await this.form.ValidateAsync();
return;
}
@@ -309,7 +309,7 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId
if (!string.IsNullOrWhiteSpace(this.dataAPIKeyStorageIssue))
{
this.dataAPIKeyStorageIssue = string.Empty;
await this.form.Validate();
await this.form.ValidateAsync();
}
}
@@ -22,7 +22,7 @@
@ref="@this.newWorkspaceNameField"
@bind-Text="@this.newWorkspaceName"
Variant="Variant.Outlined"
AutoGrow="@false"
Sizing="InputSizing.Fixed"
Lines="1"
Label="@T("Workspace name")"
AutoFocus="@true"
@@ -40,7 +40,7 @@
}
<MudStack Row="@true" Justify="Justify.FlexEnd" AlignItems="AlignItems.Center" Wrap="Wrap.NoWrap" Spacing="2">
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">
<MudButton OnClick="@this.CancelAsync" Variant="Variant.Filled">
@T("Cancel")
</MudButton>
@if (this.showCreateWorkspaceForm)
@@ -120,7 +120,7 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase
this.createWorkspaceError = null;
this.createWorkspaceErrorName = null;
await this.createWorkspaceForm.Validate();
await this.createWorkspaceForm.ValidateAsync();
if (!this.createWorkspaceForm.IsValid)
return;
@@ -132,14 +132,16 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase
{
this.createWorkspaceError = T("There is already a workspace with this name. Please choose a different name.");
this.createWorkspaceErrorName = WorkspaceBehaviour.NormalizeWorkspaceName(this.newWorkspaceName);
await this.createWorkspaceForm.Validate();
await this.createWorkspaceForm.ValidateAsync();
return;
}
this.workspaces.Add(new(result.Workspace.WorkspaceId, result.Workspace.Name));
this.selectedWorkspace = result.Workspace.WorkspaceId;
this.newWorkspaceName = string.Empty;
this.createWorkspaceForm?.ResetValidation();
if (this.createWorkspaceForm is not null)
await this.createWorkspaceForm.ResetValidationAsync();
this.showCreateWorkspaceForm = false;
await this.SendMessage(Event.WORKSPACE_CREATED, result.Workspace.WorkspaceId);
}
@@ -149,7 +151,7 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase
}
}
private void Cancel()
private async Task CancelAsync()
{
if (!this.showCreateWorkspaceForm)
{
@@ -160,7 +162,9 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase
this.createWorkspaceError = null;
this.createWorkspaceErrorName = null;
this.newWorkspaceName = string.Empty;
this.createWorkspaceForm?.ResetValidation();
if (this.createWorkspaceForm is not null)
await this.createWorkspaceForm.ResetValidationAsync();
this.showCreateWorkspaceForm = false;
this.shouldFocusNewWorkspaceName = false;
}
@@ -168,9 +172,9 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase
[JSInvokable]
public async Task HandleEscapeKeyAsync()
{
await this.InvokeAsync(() =>
await this.InvokeAsync(async () =>
{
this.Cancel();
await this.CancelAsync();
this.StateHasChanged();
});
}