Turned getter-like extension methods into extension properties (#1157)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 13:00:56 +01:00
1 parent 0375318b1b
commit f649febf88
286 files changed
+1379 -1109

No files matched your search

@@ -35,7 +35,7 @@
<MudTextField T="string" @bind-Text="@this.inputStartTime" Validation="@this.ValidateStartTime" Label="Start time" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Schedule" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("When will the meeting, seminar, etc. start? E.g., '9:00 AM', or '9:00 AM (CET)', etc. When the meeting is a multi-day event, specify the start time for each day.")" Placeholder="@T("9:00 AM")" Class="mb-3"/>
<MudTextField T="string" @bind-Text="@this.inputWhoIsPresenting" Label="@T("(Optional) Who is presenting?")" Variant="Variant.Outlined" Lines="6" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("(Optional) List the persons who will present at the meeting, seminar, etc. Use dashes (-) to separate the items.")" Placeholder="@PLACEHOLDER_WHO_IS_PRESENTING" Class="mb-3"/>
<MudTextSwitch Label="@T("Do the participants need to get to know each other first?")" @bind-Value="@this.introduceParticipants" LabelOn="@T("Yes, introduce participants")" LabelOff="@T("No, participants know each other")" />
<EnumSelection T="NumberParticipants" @bind-Value="@this.numberParticipants" NameFunc="@(participants => participants.Name())" Icon="@Icons.Material.Filled.Group" Label="@T("Number of participants")" ValidateSelection="@this.ValidateNumberParticipants"/>
<EnumSelection T="NumberParticipants" @bind-Value="@this.numberParticipants" NameFunc="@(participants => participants.Name)" Icon="@Icons.Material.Filled.Group" Label="@T("Number of participants")" ValidateSelection="@this.ValidateNumberParticipants"/>
<MudTextSwitch Label="@T("Should the participants be involved passively or actively?")" @bind-Value="@this.activeParticipation" LabelOn="@T("Active participation, like world café, discussions, etc.")" LabelOff="@T("Passive participation, like presentations, lectures, etc.")" />
<MudTextSwitch Label="@T("Is this a virtual event, e.g., a call or webinar?")" @bind-Value="@this.isMeetingVirtual" LabelOn="@T("Yes, this is a virtual event")" LabelOff="@T("No, this is a physical event")" />
@if (!this.isMeetingVirtual)
@@ -52,5 +52,5 @@
</MudPaper>
}
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting)" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -426,7 +426,7 @@ public partial class AssistantAgenda : AssistantBaseCore<SettingsDialogAgenda>
- The planned duration is '{this.inputDuration}'.
- The planned start time is '{this.inputStartTime}'.
{this.PromptGettingToKnowEachOther()}
- The number of participants is '{this.numberParticipants.Name()}'.
- The number of participants is '{this.numberParticipants.Name}'.
{this.PromptActiveParticipation()}
{this.PromptVirtualMeeting()}
{this.PromptPhysicalMeeting()}
@@ -451,7 +451,7 @@ public partial class AssistantAgenda : AssistantBaseCore<SettingsDialogAgenda>
if(this.selectedTargetLanguage is CommonLanguages.OTHER)
return this.customTargetLanguage;
return this.selectedTargetLanguage.Name();
return this.selectedTargetLanguage.Name;
}
private string PromptPhysicalMeeting()
@@ -6,7 +6,7 @@ public static class NumberParticipantsExtensions
extension(NumberParticipants numberParticipants)
{
public string Name() => numberParticipants switch
public string Name => numberParticipants switch
{
NumberParticipants.NOT_SPECIFIED => TB("Please select how many participants are expected"),
@@ -131,7 +131,7 @@
@foreach (var assistant in this.VisibleSendToAssistants)
{
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, new()))">
@assistant.Name()
@assistant.Name
</MudMenuItem>
}
</MudMenu>
@@ -163,7 +163,7 @@
@foreach (var assistant in this.VisibleSendToAssistants)
{
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
@assistant.Name()
@assistant.Name
</MudMenuItem>
}
</MudMenu>
@@ -63,7 +63,7 @@
@foreach (var source in Enum.GetValues<BatchProcessingPromptSource>())
{
<MudSelectItem Value="@source">
@source.Name()
@source.Name
</MudSelectItem>
}
</MudSelect>
@@ -149,7 +149,7 @@ else
@foreach (var mode in Enum.GetValues<BatchProcessingOutputMode>())
{
<MudSelectItem Value="@mode">
@mode.Name()
@mode.Name
</MudSelectItem>
}
</MudSelect>
@@ -157,16 +157,16 @@ else
@if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES)
{
<MudSelect T="FileExportFormat" @bind-Value="@this.resultFileFormat" Disabled="@this.isProcessingBatch" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Label="@T("File format")" HelperText="@T("Choose the format of the result files. Everything except Markdown is converted by Pandoc, which AI Studio offers to install when it is missing.")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3">
@foreach (var format in FileExportFormatExtensions.ANSWER_FORMATS)
@foreach (var format in FileExportFormat.AnswerFormats)
{
<MudSelectItem Value="@format">
@format.ToName()
@format.Name
</MudSelectItem>
}
</MudSelect>
<MudJustifiedText Typo="Typo.body2" Class="mb-3">
@(string.Format(T("Each answer is stored as its own file. Those files are named after the document, e.g., the answer for report.pdf is stored as report_result{0}."), this.resultFileFormat.ToFileExtension()))
@(string.Format(T("Each answer is stored as its own file. Those files are named after the document, e.g., the answer for report.pdf is stored as report_result{0}."), this.resultFileFormat.FileExtension))
</MudJustifiedText>
}
else
@@ -179,7 +179,7 @@ else
@foreach (var separator in Enum.GetValues<BatchProcessingCsvSeparator>())
{
<MudSelectItem Value="@separator">
@separator.Name()
@separator.Name
</MudSelectItem>
}
</MudSelect>
@@ -244,7 +244,7 @@ public partial class AssistantBatchProcessing
/// </remarks>
private string CreateResultFileName(string sourceFileName)
{
var extension = this.resultFileFormat.ToFileExtension();
var extension = this.resultFileFormat.FileExtension;
var stem = Path.GetFileNameWithoutExtension(sourceFileName);
var candidate = $"{stem}{RESULT_FILE_SUFFIX}{extension}";
@@ -21,7 +21,7 @@ public partial class AssistantBatchProcessing
// hundreds of times, and starting without it would spend time and tokens on answers we
// cannot write anywhere:
//
if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES && this.resultFileFormat.UsesPandoc())
if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES && this.resultFileFormat.UsesPandoc)
{
var pandocState = await this.PandocAvailability.EnsureAvailabilityAsync(showSuccessMessage: false, showDialog: true);
if (!pandocState.IsAvailable)
@@ -270,7 +270,7 @@ public partial class AssistantBatchProcessing
//
var resultText = this.DisclosureService.AddDisclosureToMarkdown(aiAnswer);
var resultFilePath = Path.Join(resolvedOutputDirectory, this.CreateResultFileName(fileResult.FileName));
if (this.resultFileFormat.UsesPandoc())
if (this.resultFileFormat.UsesPandoc)
{
//
// Pandoc reports a failure instead of throwing, because one document which
@@ -283,7 +283,7 @@ public partial class AssistantBatchProcessing
}
}
else
await File.WriteAllTextAsync(resultFilePath, resultText, this.resultFileFormat.ToFileEncoding(), CancellationToken.None);
await File.WriteAllTextAsync(resultFilePath, resultText, this.resultFileFormat.FileEncoding, CancellationToken.None);
this.FinishFileResult(fileResult, BatchProcessingFileStatus.DONE, Path.GetFileName(resultFilePath));
}
@@ -35,7 +35,7 @@ public partial class AssistantBatchProcessing
|| this.csvSeparator is not BatchProcessingCsvSeparator.CUSTOM)
return null;
if (!BatchProcessingCsvSeparatorExtensions.IsValidCustomSeparator(separator))
if (!BatchProcessingCsvSeparator.IsValidCustomSeparator(separator))
return T("Please enter exactly one punctuation or symbol character. Letters, numbers, spaces, quotation marks, and line breaks cannot be used as CSV separators.");
return null;
@@ -8,7 +8,7 @@ public static class BatchProcessingCsvSeparatorExtensions
extension(BatchProcessingCsvSeparator separator)
{
public string Name() => separator switch
public string Name => separator switch
{
BatchProcessingCsvSeparator.COMMA => TB("Comma (,)"),
BatchProcessingCsvSeparator.SEMICOLON => TB("Semicolon (;)"),
@@ -25,20 +25,20 @@ public static class BatchProcessingCsvSeparatorExtensions
BatchProcessingCsvSeparator.SEMICOLON => ';',
BatchProcessingCsvSeparator.PIPE => '|',
BatchProcessingCsvSeparator.TAB => '\t',
BatchProcessingCsvSeparator.CUSTOM when IsValidCustomSeparator(customSeparator) => customSeparator[0],
BatchProcessingCsvSeparator.CUSTOM when BatchProcessingCsvSeparator.IsValidCustomSeparator(customSeparator) => customSeparator[0],
_ => DEFAULT_SEPARATOR,
};
}
internal static bool IsValidCustomSeparator(string separator)
{
if (string.IsNullOrEmpty(separator) || separator.Length is not 1)
return false;
internal static bool IsValidCustomSeparator(string customSeparator)
{
if (string.IsNullOrEmpty(customSeparator) || customSeparator.Length is not 1)
return false;
var character = separator[0];
return !char.IsLetterOrDigit(character)
&& !char.IsWhiteSpace(character)
&& character is not '"' and not '\r' and not '\n';
var character = customSeparator[0];
return !char.IsLetterOrDigit(character)
&& !char.IsWhiteSpace(character)
&& character is not '"' and not '\r' and not '\n';
}
}
}
@@ -6,7 +6,7 @@ public static class BatchProcessingOutputModeExtensions
extension(BatchProcessingOutputMode outputMode)
{
public string Name() => outputMode switch
public string Name => outputMode switch
{
BatchProcessingOutputMode.INDIVIDUAL_FILES => TB("One file per document"),
BatchProcessingOutputMode.TABLE_ONLY => TB("One CSV results table, where each answer becomes one row"),
@@ -6,7 +6,7 @@ public static class BatchProcessingPromptSourceExtensions
extension(BatchProcessingPromptSource promptSource)
{
public string Name() => promptSource switch
public string Name => promptSource switch
{
BatchProcessingPromptSource.FREE_PROMPT => TB("Use a free prompt"),
BatchProcessingPromptSource.POLICY => TB("Use a document analysis policy"),
@@ -10,5 +10,5 @@
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="https://betterhumans.pub/cognitive-bias-cheat-sheet-55a472476b18">@T("Blog post of Buster Benson:") "Cognitive bias cheat sheet"</MudListItem>
</MudList>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting)" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -18,10 +18,10 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore<SettingsDialogAss
protected override string SystemPrompt => $"""
You are a friendly, helpful expert on cognitive bias. You studied psychology and
have a lot of experience. You explain a bias every day. Today's bias belongs to
the category: "{this.biasOfTheDay.Category.ToName()}". We have the following
the category: "{this.biasOfTheDay.Category.Name}". We have the following
thoughts on this category:
{this.biasOfTheDay.Category.GetThoughts()}
{this.biasOfTheDay.Category.Thoughts}
Today's bias is:
{this.biasOfTheDay.Description}
@@ -124,7 +124,7 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore<SettingsDialogAss
if(this.selectedTargetLanguage is CommonLanguages.OTHER)
return this.customTargetLanguage;
return this.selectedTargetLanguage.Name();
return this.selectedTargetLanguage.Name;
}
private async Task TellBias()
@@ -50,7 +50,7 @@
{
<MudTextField T="string" @bind-Text="@this.assistantName" AdornmentIcon="@Icons.Material.Filled.Assistant" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Display Name (Optional)")" Placeholder="@T("Meeting Task Extractor")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
}
<EnumSelection T="AssistantCategory" NameFunc="@(category => category.NameSelecting())" @bind-Value="@this.selectedCategory" ValidateSelection="@this.ValidatingCategory" Icon="@Icons.Material.Filled.Category" IconSize="Size.Small" Label="@T("Category (Optional)")" AllowOther="@true" OtherValue="AssistantCategory.OTHER" @bind-OtherInput="@this.customCategory" ValidateOther="@this.ValidateCustomCategory" LabelOther="@T("Custom assistant category")" />
<EnumSelection T="AssistantCategory" NameFunc="@(category => category.NameSelecting)" @bind-Value="@this.selectedCategory" ValidateSelection="@this.ValidatingCategory" Icon="@Icons.Material.Filled.Category" IconSize="Size.Small" Label="@T("Category (Optional)")" AllowOther="@true" OtherValue="AssistantCategory.OTHER" @bind-OtherInput="@this.customCategory" ValidateOther="@this.ValidateCustomCategory" LabelOther="@T("Custom assistant category")" />
@if (!this.createChatLauncher)
{
<MudTextField T="string" @bind-Text="@this.typicalInput" AdornmentIcon="@Icons.Material.Filled.Login" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Typical input (Optional)")" Placeholder="@T("What users provide, e.g. text, notes, files, or a URL")" Variant="Variant.Outlined" Margin="Margin.Dense" Lines="3" Sizing="InputSizing.Auto" MaxLines="8" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
@@ -59,11 +59,11 @@
@foreach (var component in ASSISTANT_COMPONENT_OPTIONS)
{
<MudSelectItem T="AssistantComponentType" Value="@component">
@component.GetDisplayName()
@component.DisplayName
</MudSelectItem>
}
</MudSelect>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedOutputLanguage" Icon="@Icons.Material.Filled.Translate" IconSize="Size.Small" Label="@T("(Optional) Output language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customOutputLanguage" ValidateOther="@this.ValidateCustomOutputLanguage" LabelOther="@T("Custom output language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedOutputLanguage" Icon="@Icons.Material.Filled.Translate" IconSize="Size.Small" Label="@T("(Optional) Output language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customOutputLanguage" ValidateOther="@this.ValidateCustomOutputLanguage" LabelOther="@T("Custom output language")" />
<MudSwitch T="bool" @bind-Value="@this.allowGeneratedAssistantProfiles" Label="@T("Allow AI Studio profiles")" LabelPlacement="Placement.End" Color="Color.Primary" Class="mb-3"/>
<MudTextField T="string" @bind-Text="@this.extraRules" AdornmentIcon="@Icons.Material.Filled.Rule" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Additional rules (Optional)")" Placeholder="@T("What to avoid or consider, e.g. do not invent missing facts")" Variant="Variant.Outlined" Margin="Margin.Dense" Lines="3" Sizing="InputSizing.Auto" MaxLines="10" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<MudTextField T="string" @bind-Text="@this.exampleRequest" AdornmentIcon="@Icons.Material.Filled.Lightbulb" Adornment="Adornment.Start" IconSize="Size.Small" Label="@T("Example prompt (Optional)")" Placeholder="@T("An expected user prompt, e.g. summarize this document")" Variant="Variant.Outlined" Margin="Margin.Dense" Lines="3" Sizing="InputSizing.Auto" MaxLines="10" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
@@ -201,8 +201,8 @@ else
}
else if (this.AuditCompleted)
{
<MudAlert Severity="@this.AuditSeverity" Dense="@true" Icon="@this.pluginAudit!.Level.GetIcon()">
<strong>@this.pluginAudit.Level.GetName()</strong><span>: @this.pluginAudit.Summary</span>
<MudAlert Severity="@this.AuditSeverity" Dense="@true" Icon="@this.pluginAudit!.Level.Icon">
<strong>@this.pluginAudit.Level.Name</strong><span>: @this.pluginAudit.Summary</span>
</MudAlert>
}
else
@@ -520,14 +520,14 @@ public partial class AssistantBuilder : AssistantBaseCore<SettingsDialogAssistan
{
AssistantCategory.AS_IS => string.Empty,
AssistantCategory.OTHER => this.customCategory,
_ => this.selectedCategory.Name(),
_ => this.selectedCategory.Name,
};
private string GetSelectedOutputLanguageName() => this.selectedOutputLanguage switch
{
CommonLanguages.AS_IS => string.Empty,
CommonLanguages.OTHER => this.customOutputLanguage,
_ => this.selectedOutputLanguage.Name(),
_ => this.selectedOutputLanguage.Name,
};
private string GetSelectedAssistantComponentText(IReadOnlyList<string?>? selectedValues)
@@ -625,7 +625,7 @@ public partial class AssistantBuilder : AssistantBaseCore<SettingsDialogAssistan
private string GetAssistantComponentDisplayName(string? typeName)
{
if (Enum.TryParse<AssistantComponentType>(typeName, out var type))
return type.GetDisplayName();
return type.DisplayName;
return typeName ?? string.Empty;
}
@@ -726,7 +726,7 @@ public partial class AssistantBuilder : AssistantBaseCore<SettingsDialogAssistan
this.UpsertAudit(this.pluginAudit);
await this.SettingsManager.StoreSettings();
await this.MessageBus.SendSuccess(new(
this.pluginAudit.Level.GetIcon(),
this.pluginAudit.Level.Icon,
this.pluginAudit.Findings.Count == 0
? T("Security check completed. No security issues were found.")
: T("Security check completed with findings.")));
@@ -787,8 +787,8 @@ public partial class AssistantBuilder : AssistantBaseCore<SettingsDialogAssistan
string.Format(
T("The assistant '{0}' was checked with the level '{1}', which is below your required level '{2}'. Your settings allow activation anyway, but this may be unsafe. Do you want to enable this assistant?"),
this.pluginInstallResult?.PluginName ?? T("Unknown assistant"),
this.pluginAudit?.Level.GetName() ?? T("Unknown"),
this.SettingsManager.ConfigurationData.AssistantPluginAudit.MinimumLevel.GetName())
this.pluginAudit?.Level.Name ?? T("Unknown"),
this.SettingsManager.ConfigurationData.AssistantPluginAudit.MinimumLevel.Name)
},
};
@@ -6,7 +6,7 @@ public static class CommonCodingLanguageExtensions
extension(CommonCodingLanguages language)
{
public string Name() => language switch
public string Name => language switch
{
CommonCodingLanguages.NONE => TB("None"),
@@ -29,8 +29,8 @@ else
@if (this.audit is not null && this.audit.Level is not AssistantAuditLevel.SAFE)
{
<MudPaper Class="pa-4 ma-4" Elevation="0">
<MudAlert Severity="@this.audit.Level.GetSeverity()" Variant="Variant.Filled" Square="false" Elevation="6" Class="pa-4">
<strong>@this.audit.Level.GetName().ToUpperInvariant(): </strong>@this.audit.Summary
<MudAlert Severity="@this.audit.Level.Severity" Variant="Variant.Filled" Square="false" Elevation="6" Class="pa-4">
<strong>@this.audit.Level.Name.ToUpperInvariant(): </strong>@this.audit.Summary
</MudAlert>
</MudPaper>
}
@@ -20,6 +20,6 @@
}
</MudSelect>
<MudTextField T="string" @bind-Text="@this.inputName" Label="@T("(Optional) Your name for the closing salutation")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Person" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Your name for the closing salutation of your e-mail.")" Class="mb-3"/>
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name())" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Select the writing style")" ValidateSelection="@this.ValidateWritingStyle"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name)" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Select the writing style")" ValidateSelection="@this.ValidateWritingStyle"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting)" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -17,7 +17,7 @@ public partial class AssistantEMail : AssistantBaseCore<SettingsDialogWritingEMa
protected override string SystemPrompt =>
$"""
You are an automated system that writes emails. {this.SystemPromptHistory()} The user provides you with bullet points on what
he want to address in the response. Regarding the writing style of the email: {this.selectedWritingStyle.Prompt()}
he want to address in the response. Regarding the writing style of the email: {this.selectedWritingStyle.Prompt}
{this.SystemPromptGreeting()} {this.SystemPromptName()} You write the email in the following language: {this.SystemPromptLanguage()}.
""";
@@ -227,7 +227,7 @@ public partial class AssistantEMail : AssistantBaseCore<SettingsDialogWritingEMa
if(this.selectedTargetLanguage is CommonLanguages.OTHER)
return this.customTargetLanguage;
return this.selectedTargetLanguage.Name();
return this.selectedTargetLanguage.Name;
}
private string PromptFoci()
@@ -6,7 +6,7 @@ public static class WritingStylesExtensions
extension(WritingStyles style)
{
public string Name() => style switch
public string Name => style switch
{
WritingStyles.ACADEMIC => TB("Academic"),
WritingStyles.PERSONAL => TB("Personal"),
@@ -16,7 +16,7 @@ public static class WritingStylesExtensions
_ => TB("Not specified"),
};
public string Prompt() => style switch
public string Prompt => style switch
{
WritingStyles.ACADEMIC => "Use an academic style for communication in an academic context like between students and professors.",
WritingStyles.PERSONAL => "Use a personal style for communication between friends and family.",
@@ -6,7 +6,7 @@ public static class AllowedLLMProvidersExtensions
extension(AllowedLLMProviders provider)
{
public string Description() => provider switch
public string Description => provider switch
{
AllowedLLMProviders.NONE => TB("Please select what kind of LLM provider are allowed for this data source"),
AllowedLLMProviders.ANY => TB("Any LLM provider is allowed: users might choose a cloud-based or a self-hosted provider"),
@@ -97,7 +97,7 @@ else
@foreach (var language in Enum.GetValues<ProgrammingLanguages>())
{
<MudSelectItem Value="@language">
@language.Name()
@language.Name
</MudSelectItem>
}
</MudSelect>
@@ -130,7 +130,7 @@ else
@foreach (var dataSource in Enum.GetValues<DataSources>())
{
<MudSelectItem Value="@dataSource">
@dataSource.Name()
@dataSource.Name
</MudSelectItem>
}
</MudSelect>
@@ -181,7 +181,7 @@ else
@foreach (var authMethod in Enum.GetValues<Auth>())
{
<MudSelectItemExtended Value="@authMethod">
@authMethod.Name()
@authMethod.Name
</MudSelectItemExtended>
}
</MudSelectExtended>
@@ -194,7 +194,7 @@ else
@foreach (var os in Enum.GetValues<OperatingSystem>())
{
<MudSelectItem Value="@os">
@os.Name()
@os.Name
</MudSelectItem>
}
</MudSelect>
@@ -208,7 +208,7 @@ else
@foreach (var option in Enum.GetValues<AllowedLLMProviders>())
{
<MudSelectItem Value="@option">
@option.Description()
@option.Description
</MudSelectItem>
}
</MudSelect>
@@ -378,7 +378,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
/// <summary>
/// Gets whether the selected ERI specification cannot be saved.
/// </summary>
private bool IsSpecificationSavingDisabled => !this.selectedERIVersion.WasSpecificationSelected() || this.IsERIInputDisabled;
private bool IsSpecificationSavingDisabled => !this.selectedERIVersion.WasSpecificationSelected || this.IsERIInputDisabled;
/// <summary>
/// Lets the user save the selected ERI specification, a copy of the one the app carries.
@@ -389,7 +389,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
/// </remarks>
private async Task SaveSpecificationAsync()
{
var specificationPath = this.selectedERIVersion.SpecificationURL();
var specificationPath = this.selectedERIVersion.SpecificationURL;
var response = await this.RustService.SaveFile(T("Save the ERI specification"), [FileTypes.JSON], Path.GetFileName(specificationPath));
if (response.UserCancelled)
return;
@@ -6,7 +6,7 @@ public static class AuthExtensions
extension(Auth auth)
{
public string Name() => auth switch
public string Name => auth switch
{
Auth.NONE => TB("No login necessary: useful for public data sources"),
@@ -17,7 +17,7 @@ public static class AuthExtensions
_ => TB("Unknown login method")
};
public string ToPrompt() => auth switch
public string Prompt => auth switch
{
Auth.NONE => "No login is necessary, the data source is public.",
@@ -6,7 +6,7 @@ public static class DataSourcesExtensions
extension(DataSources dataSource)
{
public string Name() => dataSource switch
public string Name => dataSource switch
{
DataSources.NONE => TB("No data source selected"),
DataSources.CUSTOM => TB("Custom description"),
@@ -58,7 +58,7 @@ internal sealed class ERIServerPrompt
// Introduction
// ---------------------------------
//
var programmingLanguage = this.ProgrammingLanguage is ProgrammingLanguages.OTHER ? this.OtherProgrammingLanguage : this.ProgrammingLanguage.ToPrompt();
var programmingLanguage = this.ProgrammingLanguage is ProgrammingLanguages.OTHER ? this.OtherProgrammingLanguage : this.ProgrammingLanguage.Prompt;
sb.Append($"""
# Introduction
You are an experienced {programmingLanguage} developer. Your task is to implement an API server in
@@ -172,7 +172,7 @@ internal sealed class ERIServerPrompt
{
sb.Append($"""
- {auth.ToPrompt()}
- {auth.Prompt}
""");
}
@@ -192,7 +192,7 @@ internal sealed class ERIServerPrompt
{
sb.Append($"""
The server will run on {this.OperatingSystem.ToPrompt()} operating systems. Keep
The server will run on {this.OperatingSystem.Prompt} operating systems. Keep
this in mind when implementing the SSO with Kerberos.
""");
}
@@ -4,15 +4,18 @@ public static class ERIVersionExtensions
{
extension(ERIVersion version)
{
public Task<string> ReadSpecification(WebRootFiles webRootFiles) => webRootFiles.ReadTextAsync(version.SpecificationURL());
public Task<string> ReadSpecification(WebRootFiles webRootFiles) => webRootFiles.ReadTextAsync(version.SpecificationURL);
public string SpecificationURL()
public string SpecificationURL
{
var nameLower = version.ToString().ToLowerInvariant();
var filename = $"{nameLower}.json";
return $"specs/eri/{filename}";
get
{
var nameLower = version.ToString().ToLowerInvariant();
var filename = $"{nameLower}.json";
return $"specs/eri/{filename}";
}
}
public bool WasSpecificationSelected() => version != ERIVersion.NONE;
public bool WasSpecificationSelected => version != ERIVersion.NONE;
}
}
@@ -6,7 +6,7 @@ public static class OperatingSystemExtensions
extension(OperatingSystem os)
{
public string Name() => os switch
public string Name => os switch
{
OperatingSystem.NONE => TB("No operating system specified"),
@@ -16,7 +16,7 @@ public static class OperatingSystemExtensions
_ => TB("Unknown operating system")
};
public string ToPrompt() => os switch
public string Prompt => os switch
{
OperatingSystem.NONE => "No operating system specified",
@@ -6,7 +6,7 @@ public static class ProgrammingLanguagesExtensions
extension(ProgrammingLanguages language)
{
public string Name() => language switch
public string Name => language switch
{
ProgrammingLanguages.NONE => TB("No programming language selected"),
@@ -26,7 +26,7 @@ public static class ProgrammingLanguagesExtensions
_ => TB("Unknown")
};
public string ToPrompt() => language switch
public string Prompt => language switch
{
ProgrammingLanguages.NONE => "No programming language selected",
@@ -3,5 +3,5 @@
<ReadFileContent Text="@T("Load text from file")" @bind-FileContent="@this.inputText" EnableDragDrop="true" CatchAllDocuments="true"/>
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input to check")" Variant="Variant.Outlined" Lines="6" Sizing="InputSizing.Auto" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -124,7 +124,7 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore<SettingsDialog
CommonLanguages.AS_IS => "the source language",
CommonLanguages.OTHER => this.customTargetLanguage,
_ => $"{this.selectedTargetLanguage.Name()}",
_ => $"{this.selectedTargetLanguage.Name}",
};
if (string.IsNullOrWhiteSpace(lang))
@@ -2,7 +2,7 @@
@using AIStudio.Settings
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogI18N>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" SelectionUpdated="_ => this.OnChangedLanguage()" Disabled="@this.IsProcessing" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting)" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" SelectionUpdated="_ => this.OnChangedLanguage()" Disabled="@this.IsProcessing" />
<ConfigurationSelect OptionDescription="@T("Language plugin used for comparision")" SelectedValue="@(() => this.selectedLanguagePluginId)" Data="@ConfigurationSelectDataFactory.GetLanguagesData()" SelectionUpdate="@(async void (id) => await this.OnLanguagePluginChanged(id))" OptionHelp="@T("Select the language plugin used for comparision.")" Disabled="@(() => this.IsProcessing)"/>
@if (this.isLoading)
{
@@ -190,7 +190,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
private string SystemPromptLanguage() => this.activeSystemPromptLanguage ?? (this.selectedTargetLanguage switch
{
CommonLanguages.OTHER => this.customTargetLanguage,
_ => $"{this.selectedTargetLanguage.Name()}",
_ => $"{this.selectedTargetLanguage.Name}",
});
private async Task OnLanguagePluginChanged(Guid pluginId)
@@ -215,9 +215,9 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
this.loadingIssue = string.Format(T("Was not able to load the language plugin for comparison ({0}). Please select a valid, loaded & running language plugin."), this.selectedLanguagePluginId);
this.selectedLanguagePlugin = null;
}
else if (comparisonPlugin.IETFTag != this.selectedTargetLanguage.ToIETFTag())
else if (comparisonPlugin.IETFTag != this.selectedTargetLanguage.IETFTag)
{
this.loadingIssue = string.Format(T("The selected language plugin for comparison uses the IETF tag '{0}' which does not match the selected target language '{1}'. Please select a valid, loaded & running language plugin which matches the target language."), comparisonPlugin.IETFTag, this.selectedTargetLanguage.ToIETFTag());
this.loadingIssue = string.Format(T("The selected language plugin for comparison uses the IETF tag '{0}' which does not match the selected target language '{1}'. Please select a valid, loaded & running language plugin which matches the target language."), comparisonPlugin.IETFTag, this.selectedTargetLanguage.IETFTag);
this.selectedLanguagePlugin = null;
}
else
@@ -356,7 +356,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
if(this.selectedLanguagePlugin is null)
return;
if (this.selectedLanguagePlugin.IETFTag != this.selectedTargetLanguage.ToIETFTag())
if (this.selectedLanguagePlugin.IETFTag != this.selectedTargetLanguage.IETFTag)
return;
var addedContentSnapshot = this.addedContent.ToArray();
@@ -8,13 +8,13 @@
@foreach (var source in Enum.GetValues<IconSources>())
{
<MudSelectItem Value="@source">
@source.Name()
@source.Name
</MudSelectItem>
}
</MudSelect>
@if (this.selectedIconSource is not IconSources.GENERIC)
{
<MudButton Href="@this.selectedIconSource.URL()" Target="_blank" Variant="Variant.Filled" Size="Size.Medium">
<MudButton Href="@this.selectedIconSource.URL" Target="_blank" Variant="Variant.Filled" Size="Size.Medium">
@T("Open website")
</MudButton>
}
@@ -31,7 +31,7 @@ public partial class AssistantIconFinder : AssistantBaseCore<SettingsDialogIconF
protected override string SendToChatVisibleUserPromptText =>
$"""
{string.Format(T("Find icon suggestions on {0} for the following context:"), this.selectedIconSource.Name())}
{string.Format(T("Find icon suggestions on {0} for the following context:"), this.selectedIconSource.Name)}
{this.inputContext}
""";
@@ -98,7 +98,7 @@ public partial class AssistantIconFinder : AssistantBaseCore<SettingsDialogIconF
this.CreateChatThread();
var time = this.AddUserRequest(
$"""
{this.selectedIconSource.Prompt()} I search for an icon for the following context:
{this.selectedIconSource.Prompt} I search for an icon for the following context:
```
{this.inputContext}
@@ -4,7 +4,7 @@ public static class IconSourceExtensions
{
extension(IconSources iconSource)
{
public string Name() => iconSource switch
public string Name => iconSource switch
{
IconSources.FLAT_ICON => "Flaticon",
IconSources.FONT_AWESOME => "Font Awesome",
@@ -16,7 +16,7 @@ public static class IconSourceExtensions
_ => "Generic",
};
public string Prompt() => iconSource switch
public string Prompt => iconSource switch
{
IconSources.FLAT_ICON => "My icon source is Flaticon.",
IconSources.FONT_AWESOME => "I look for an icon on Font Awesome. Please provide just valid icon names. Valid icon names are using the format `fa-icon-name`.",
@@ -28,7 +28,7 @@ public static class IconSourceExtensions
_ => string.Empty,
};
public string URL() => iconSource switch
public string URL => iconSource switch
{
IconSources.FLAT_ICON => "https://www.flaticon.com/",
IconSources.FONT_AWESOME => "https://fontawesome.com/",
@@ -16,5 +16,5 @@
<MudTextField T="string" @bind-Text="@this.inputEntryDate" Label="@T("(Optional) Provide the entry date")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
<MudTextField T="string" @bind-Text="@this.inputValidUntil" Label="@T("(Optional) Provide the date until the job posting is valid")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -212,7 +212,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
if(this.selectedTargetLanguage is CommonLanguages.OTHER)
return this.customTargetLanguage;
return this.selectedTargetLanguage.Name();
return this.selectedTargetLanguage.Name;
}
private string UserPromptMandatoryInformation()
@@ -10,5 +10,5 @@
<div class="mb-3">
<AttachDocuments Name="My Tasks Documents" @bind-DocumentPaths="@this.loadedDocumentPaths" OnChange="@this.OnDocumentsChanged" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.ProviderSettings"/>
</div>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -182,7 +182,7 @@ public partial class AssistantMyTasks : AssistantBaseCore<SettingsDialogMyTasks>
if(this.selectedTargetLanguage is CommonLanguages.OTHER)
return this.customTargetLanguage;
return this.selectedTargetLanguage.Name();
return this.selectedTargetLanguage.Name;
}
private ContentBlock CloneHiddenUserBlockWithoutAttachments(ContentBlock block)
@@ -18,7 +18,7 @@
UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages"
NameFunc="@(language => language.NameSelectingOptional())"
NameFunc="@(language => language.NameSelectingOptional)"
@bind-Value="@this.selectedTargetLanguage"
Icon="@Icons.Material.Filled.Translate"
Label="@T("Language for the optimized prompt")"
@@ -280,7 +280,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
{
CommonLanguages.AS_IS => "the source language of the input prompt",
CommonLanguages.OTHER => this.customTargetLanguage,
_ => this.selectedTargetLanguage.Name(),
_ => this.selectedTargetLanguage.Name,
};
if (string.IsNullOrWhiteSpace(language))
@@ -3,7 +3,7 @@
<ReadFileContent Text="@T("Load text from file")" @bind-FileContent="@this.inputText" EnableDragDrop="true" CatchAllDocuments="true"/>
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input to improve")" Variant="Variant.Outlined" Lines="6" Sizing="InputSizing.Auto" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name())" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Writing style")" AllowOther="@false" />
<EnumSelection T="SentenceStructure" NameFunc="@(voice => voice.Name())" @bind-Value="@this.selectedSentenceStructure" Icon="@Icons.Material.Filled.Person4" Label="@T("Sentence structure")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name)" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Writing style")" AllowOther="@false" />
<EnumSelection T="SentenceStructure" NameFunc="@(voice => voice.Name)" @bind-Value="@this.selectedSentenceStructure" Icon="@Icons.Material.Filled.Person4" Label="@T("Sentence structure")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -19,7 +19,7 @@ public partial class AssistantRewriteImprove : AssistantBaseCore<SettingsDialogR
text. You can also correct spelling and grammar issues. You never add additional information. You never
ask the user for additional information. Your response only contains the improved text. You do not explain
your changes. If no changes are needed, you return the text unchanged.
The style of the text: {this.selectedWritingStyle.Prompt()}.{this.selectedSentenceStructure.Prompt()}
The style of the text: {this.selectedWritingStyle.Prompt}.{this.selectedSentenceStructure.Prompt}
You follow the rules according to {this.SystemPromptLanguage()} in all your changes.
""";
@@ -137,7 +137,7 @@ public partial class AssistantRewriteImprove : AssistantBaseCore<SettingsDialogR
CommonLanguages.AS_IS => "the source language",
CommonLanguages.OTHER => this.customTargetLanguage,
_ => $"{this.selectedTargetLanguage.Name()}",
_ => $"{this.selectedTargetLanguage.Name}",
};
if (string.IsNullOrWhiteSpace(lang))
@@ -6,7 +6,7 @@ public static class SentenceStructureExtensions
extension(SentenceStructure sentenceStructure)
{
public string Name() => sentenceStructure switch
public string Name => sentenceStructure switch
{
SentenceStructure.ACTIVE => TB("Active voice"),
SentenceStructure.PASSIVE => TB("Passive voice"),
@@ -14,7 +14,7 @@ public static class SentenceStructureExtensions
_ => TB("Not Specified"),
};
public string Prompt() => sentenceStructure switch
public string Prompt => sentenceStructure switch
{
SentenceStructure.ACTIVE => " Use an active voice for the sentence structure.",
SentenceStructure.PASSIVE => " Use a passive voice for the sentence structure.",
@@ -6,7 +6,7 @@ public static class WritingStylesExtensions
extension(WritingStyles style)
{
public string Name() => style switch
public string Name => style switch
{
WritingStyles.EVERYDAY => TB("Everyday (personal texts, social media)"),
WritingStyles.BUSINESS => TB("Business (business emails, reports, presentations)"),
@@ -22,7 +22,7 @@ public static class WritingStylesExtensions
_ => TB("Not specified"),
};
public string Prompt() => style switch
public string Prompt => style switch
{
WritingStyles.EVERYDAY => "Use a everyday style like for personal texts, social media, and informal communication.",
WritingStyles.BUSINESS => "Use a business style like for business emails, reports, and presentations. Most important is clarity and professionalism.",
@@ -34,6 +34,6 @@
<AttachDocuments Name="SWOT Analysis Context Material" @bind-DocumentPaths="@this.contextMaterials" UseSmallForm="false" Provider="@this.ProviderSettings"/>
<div style="margin-top: 20px;">
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
</div>
@@ -7,7 +7,7 @@ internal static class SwotAnalysisCategoryExtensions
/// <summary>
/// The name of the category in the JSON the models read and write, e.g., "strengths".
/// </summary>
public string JsonName() => category switch
public string JsonName => category switch
{
SwotAnalysisCategory.STRENGTHS => "strengths",
SwotAnalysisCategory.WEAKNESSES => "weaknesses",
@@ -20,7 +20,7 @@ internal static class SwotAnalysisCategoryExtensions
/// <summary>
/// The letter the factor IDs of the category start with, e.g., S1 for the first strength.
/// </summary>
public string FactorIdPrefix() => category switch
public string FactorIdPrefix => category switch
{
SwotAnalysisCategory.STRENGTHS => "S",
SwotAnalysisCategory.WEAKNESSES => "W",
@@ -78,8 +78,8 @@ internal static class SwotAnalysisModeration
string sharedResearch = "")
{
var payload = Enum.GetValues<SwotAnalysisCategory>().ToDictionary(
category => category.JsonName(),
category => CreateCategoryPayload(categories[category], category.FactorIdPrefix()));
category => category.JsonName,
category => CreateCategoryPayload(categories[category], category.FactorIdPrefix));
return $"""
Reconcile these preliminary results of the four SWOT categories. Then write the overall assessment
@@ -152,12 +152,12 @@ internal static class SwotAnalysisModerationResponseParser
/// <returns>The first issue, or an empty string.</returns>
private static string FindIssue(SwotAnalysisCategory category, SwotModeratedCategory moderatedCategory, HashSet<string> factorIds)
{
var name = category.JsonName();
var name = category.JsonName;
var listIssue = FindListIssue(name, moderatedCategory.Findings.Count, moderatedCategory.EmptyMessage);
if (listIssue.Length > 0)
return listIssue;
var prefix = category.FactorIdPrefix();
var prefix = category.FactorIdPrefix;
for (var index = 0; index < moderatedCategory.Findings.Count; index++)
{
var finding = moderatedCategory.Findings[index];
@@ -6,7 +6,7 @@ public static class AudienceAgeGroupExtensions
extension(AudienceAgeGroup ageGroup)
{
public string Name() => ageGroup switch
public string Name => ageGroup switch
{
AudienceAgeGroup.UNSPECIFIED => TB("Unspecified age group"),
AudienceAgeGroup.CHILDREN => TB("Children"),
@@ -16,7 +16,7 @@ public static class AudienceAgeGroupExtensions
_ => TB("Unspecified age group"),
};
public string Prompt() => ageGroup switch
public string Prompt => ageGroup switch
{
AudienceAgeGroup.UNSPECIFIED => "Do not tailor the text to a specific age group.",
AudienceAgeGroup.CHILDREN => "Use simple, concrete language with short sentences and minimal jargon.",
@@ -6,7 +6,7 @@ public static class AudienceExpertiseExtensions
extension(AudienceExpertise expertise)
{
public string Name() => expertise switch
public string Name => expertise switch
{
AudienceExpertise.UNSPECIFIED => TB("Unspecified expertise"),
AudienceExpertise.NON_EXPERTS => TB("No expertise"),
@@ -17,7 +17,7 @@ public static class AudienceExpertiseExtensions
_ => TB("Unspecified expertise"),
};
public string Prompt() => expertise switch
public string Prompt => expertise switch
{
AudienceExpertise.UNSPECIFIED => "Do not tailor the text to a specific expertise level.",
AudienceExpertise.NON_EXPERTS => "Avoid jargon and explain specialized concepts plainly.",
@@ -6,7 +6,7 @@ public static class AudienceOrganizationalLevelExtensions
extension(AudienceOrganizationalLevel level)
{
public string Name() => level switch
public string Name => level switch
{
AudienceOrganizationalLevel.UNSPECIFIED => TB("Unspecified organizational level"),
AudienceOrganizationalLevel.TRAINEES => TB("Trainees"),
@@ -19,7 +19,7 @@ public static class AudienceOrganizationalLevelExtensions
_ => TB("Unspecified organizational level"),
};
public string Prompt() => level switch
public string Prompt => level switch
{
AudienceOrganizationalLevel.UNSPECIFIED => "Do not tailor the text to a specific organizational level.",
AudienceOrganizationalLevel.TRAINEES => "Keep the content supportive and introductory. Explain context and avoid assuming prior organizational knowledge.",
@@ -6,7 +6,7 @@ public static class AudienceProfileExtensions
extension(AudienceProfile profile)
{
public string Name() => profile switch
public string Name => profile switch
{
AudienceProfile.UNSPECIFIED => TB("Unspecified audience profile"),
AudienceProfile.STUDENTS => TB("Students"),
@@ -23,7 +23,7 @@ public static class AudienceProfileExtensions
_ => TB("Unspecified audience profile"),
};
public string Prompt() => profile switch
public string Prompt => profile switch
{
AudienceProfile.UNSPECIFIED => "Do not tailor the text to a specific audience profile.",
AudienceProfile.STUDENTS => "Write for students. Keep it structured, easy to study, and focused on key takeaways.",
@@ -7,7 +7,7 @@ public static class PresentationOccasionExtensions
/// <param name="occasion">The occasion.</param>
extension(PresentationOccasion occasion)
{
public string Name() => occasion switch
public string Name => occasion switch
{
PresentationOccasion.UNSPECIFIED => TB("Unspecified occasion"),
PresentationOccasion.TALK => TB("Talk"),
@@ -95,22 +95,22 @@
</MudGrid>
<MudText Typo="Typo.h6" Class="mb-1 mt-3"> @T("Language")</MudText>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<MudText Typo="Typo.h6" Class="mb-1 mt-3">@T("Occasion")</MudText>
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
@T("The occasion helps the LLM to structure the presentation. A lecture, for example, may close its chapters with an interim summary or with room for questions, and a report to management leads with the key messages.")
</MudJustifiedText>
<EnumSelection T="PresentationOccasion" NameFunc="@(occasion => occasion.Name())" @bind-Value="@this.selectedOccasion" Icon="@Icons.Material.Filled.Event" Label="@T("Occasion of the presentation")" AllowOther="@true" @bind-OtherInput="@this.customOccasion" OtherValue="PresentationOccasion.OTHER" LabelOther="@T("Other occasion")" ValidateOther="@this.ValidateCustomOccasion" />
<EnumSelection T="PresentationOccasion" NameFunc="@(occasion => occasion.Name)" @bind-Value="@this.selectedOccasion" Icon="@Icons.Material.Filled.Event" Label="@T("Occasion of the presentation")" AllowOther="@true" @bind-OtherInput="@this.customOccasion" OtherValue="PresentationOccasion.OTHER" LabelOther="@T("Other occasion")" ValidateOther="@this.ValidateCustomOccasion" />
<MudText Typo="Typo.h6" Class="mb-1 mt-3"> @T("Audience")</MudText>
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
@T("Please specify the audience for the planned presentation. This will help the LLM to create a presentation that fits your needs. You can specify the audience profile, the age group, organizational level, and the expertise. You don't have to specify all of these parameters, for example you might only want to specify the audience profile and leave the other parameters at their default values.")
</MudJustifiedText>
<EnumSelection T="AudienceProfile" NameFunc="@(profile => profile.Name())" @bind-Value="@this.selectedAudienceProfile" Icon="@Icons.Material.Filled.Groups" Label="@T("Audience profile")" />
<EnumSelection T="AudienceAgeGroup" NameFunc="@(ageGroup => ageGroup.Name())" @bind-Value="@this.selectedAudienceAgeGroup" Icon="@Icons.Material.Filled.Cake" Label="@T("Audience age group")" />
<EnumSelection T="AudienceOrganizationalLevel" NameFunc="@(level => level.Name())" @bind-Value="@this.selectedAudienceOrganizationalLevel" Icon="@Icons.Material.Filled.AccountTree" Label="@T("Audience organizational level")" />
<EnumSelection T="AudienceExpertise" NameFunc="@(expertise => expertise.Name())" @bind-Value="@this.selectedAudienceExpertise" Icon="@Icons.Material.Filled.School" Label="@T("Audience expertise")" />
<EnumSelection T="AudienceProfile" NameFunc="@(profile => profile.Name)" @bind-Value="@this.selectedAudienceProfile" Icon="@Icons.Material.Filled.Groups" Label="@T("Audience profile")" />
<EnumSelection T="AudienceAgeGroup" NameFunc="@(ageGroup => ageGroup.Name)" @bind-Value="@this.selectedAudienceAgeGroup" Icon="@Icons.Material.Filled.Cake" Label="@T("Audience age group")" />
<EnumSelection T="AudienceOrganizationalLevel" NameFunc="@(level => level.Name)" @bind-Value="@this.selectedAudienceOrganizationalLevel" Icon="@Icons.Material.Filled.AccountTree" Label="@T("Audience organizational level")" />
<EnumSelection T="AudienceExpertise" NameFunc="@(expertise => expertise.Name)" @bind-Value="@this.selectedAudienceExpertise" Icon="@Icons.Material.Filled.School" Label="@T("Audience expertise")" />
<MudText Typo="Typo.h5" Class="mb-1 mt-6"> @T("PowerPoint template")</MudText>
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
@@ -160,7 +160,7 @@
</MudJustifiedText>
<LayoutChoicePanels IsChosen="@(purpose => this.LayoutNameOf(purpose).Length > 0)">
<ChoiceContent Context="purpose">
<MudSelect T="string" Value="@this.LayoutNameOf(purpose)" ValueChanged="@(name => this.SetLayoutName(purpose, name))" Disabled="@this.AreLayoutsLocked" Label="@purpose.Label()" HelperText="@purpose.Help()" Variant="Variant.Outlined" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.ViewQuilt" Class="mb-3">
<MudSelect T="string" Value="@this.LayoutNameOf(purpose)" ValueChanged="@(name => this.SetLayoutName(purpose, name))" Disabled="@this.AreLayoutsLocked" Label="@purpose.Label" HelperText="@purpose.Help" Variant="Variant.Outlined" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.ViewQuilt" Class="mb-3">
<MudSelectItem T="string" Value="@string.Empty">@LayoutPurposeExtensions.NoPreference</MudSelectItem>
@foreach (var layoutName in loadedTemplate.FamilyNames)
{
@@ -178,7 +178,7 @@
</MudJustifiedText>
@foreach (var templateSlide in loadedTemplate.Slides)
{
<EnumSelection T="TemplateSlideUse" NameFunc="@(use => use.Name())" Value="@this.TemplateSlideUseOf(templateSlide.Number)" ValueChanged="@(use => this.SetTemplateSlideUse(templateSlide.Number, use))" ValidateSelection="@(use => this.ValidateTemplateSlideUse(templateSlide, use))" Disabled="@this.AreTemplateSlideUsesLocked" Icon="@Icons.Material.Filled.Slideshow" Label="@templateSlide.Label()"/>
<EnumSelection T="TemplateSlideUse" NameFunc="@(use => use.Name)" Value="@this.TemplateSlideUseOf(templateSlide.Number)" ValueChanged="@(use => this.SetTemplateSlideUse(templateSlide.Number, use))" ValidateSelection="@(use => this.ValidateTemplateSlideUse(templateSlide, use))" Disabled="@this.AreTemplateSlideUsesLocked" Icon="@Icons.Material.Filled.Slideshow" Label="@templateSlide.Label"/>
}
}
</CompactExpansionPanel>
@@ -491,16 +491,16 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
var prompts = new List<string>();
if (this.selectedAudienceProfile is not AudienceProfile.UNSPECIFIED)
prompts.Add(this.selectedAudienceProfile.Prompt());
prompts.Add(this.selectedAudienceProfile.Prompt);
if (this.selectedAudienceAgeGroup is not AudienceAgeGroup.UNSPECIFIED)
prompts.Add(this.selectedAudienceAgeGroup.Prompt());
prompts.Add(this.selectedAudienceAgeGroup.Prompt);
if (this.selectedAudienceOrganizationalLevel is not AudienceOrganizationalLevel.UNSPECIFIED)
prompts.Add(this.selectedAudienceOrganizationalLevel.Prompt());
prompts.Add(this.selectedAudienceOrganizationalLevel.Prompt);
if (this.selectedAudienceExpertise is not AudienceExpertise.UNSPECIFIED)
prompts.Add(this.selectedAudienceExpertise.Prompt());
prompts.Add(this.selectedAudienceExpertise.Prompt);
if (prompts.Count == 0)
return " - Do not tailor the text to a specific audience.";
@@ -20,14 +20,17 @@ internal static class TemplateSlideExtensions
/// The title tells the slides apart at a glance, since a template rarely gives its slides more
/// than a title. A long one is cut, so that the label stays on one line.
/// </remarks>
public string Label()
public string Label
{
var title = slide.Title.Length > MAX_SLIDE_TITLE_CHARACTERS ? $"{slide.Title[..MAX_SLIDE_TITLE_CHARACTERS].TrimEnd()}…" : slide.Title;
var label = title.Length > 0 ? string.Format(TB("Slide {0}: {1}"), slide.Number, title) : string.Format(TB("Slide {0}"), slide.Number);
if (slide.IsHidden)
label = $"{label} ({TB("hidden")})";
get
{
var title = slide.Title.Length > MAX_SLIDE_TITLE_CHARACTERS ? $"{slide.Title[..MAX_SLIDE_TITLE_CHARACTERS].TrimEnd()}…" : slide.Title;
var label = title.Length > 0 ? string.Format(TB("Slide {0}: {1}"), slide.Number, title) : string.Format(TB("Slide {0}"), slide.Number);
if (slide.IsHidden)
label = $"{label} ({TB("hidden")})";
return label;
return label;
}
}
}
}
@@ -8,7 +8,7 @@ internal static class TemplateSlideUseExtensions
extension(TemplateSlideUse use)
{
public string Name() => use switch
public string Name => use switch
{
TemplateSlideUse.OMIT => TB("Leave out"),
TemplateSlideUse.KEEP => TB("Keep unchanged"),
@@ -4,5 +4,5 @@
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.Spellcheck" Adornment="Adornment.Start" Label="@T("Your word or phrase")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<MudTextField T="string" @bind-Text="@this.inputContext" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Lines="2" Sizing="InputSizing.Fixed" Label="@T("(Optional) The context for the given word or phrase")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional)" @bind-Value="@this.selectedLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -157,7 +157,7 @@ public partial class AssistantSynonyms : AssistantBaseCore<SettingsDialogSynonym
CommonLanguages.AS_IS => "source",
CommonLanguages.OTHER => this.customTargetLanguage,
_ => $"{this.selectedLanguage.Name()}",
_ => $"{this.selectedLanguage.Name}",
};
if (string.IsNullOrWhiteSpace(lang))
@@ -8,7 +8,7 @@
<ReadFileContent @bind-FileContent="@this.inputText" EnableDragDrop="true" CatchAllDocuments="true"/>
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" Sizing="InputSizing.Auto" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name)" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name)" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
<MudTextField T="string" Sizing="InputSizing.Auto" Lines="2" @bind-Text="@this.importantAspects" class="mb-3" Label="@T("(Optional) Important Aspects")" HelperText="@T("(Optional) Specify aspects for the LLM to focus on when generating a summary, such as summary length or specific topics to emphasize.")" ShrinkLabel="true" Variant="Variant.Outlined" AdornmentIcon="@Icons.Material.Filled.List" Adornment="Adornment.Start"/>
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -6,7 +6,7 @@ public static class ComplexityExtensions
extension(Complexity complexity)
{
public string Name() => complexity switch
public string Name => complexity switch
{
Complexity.NO_CHANGE => TB("No change in complexity"),
@@ -18,5 +18,5 @@ else
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" Sizing="InputSizing.Auto" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
}
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting)" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
@@ -39,7 +39,7 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
protected override string SendToChatVisibleUserPromptText =>
$"""
{string.Format(T("Translate the following text to {0}:"), this.selectedTargetLanguage is CommonLanguages.OTHER ? this.customTargetLanguage : this.selectedTargetLanguage.Name())}
{string.Format(T("Translate the following text to {0}:"), this.selectedTargetLanguage is CommonLanguages.OTHER ? this.customTargetLanguage : this.selectedTargetLanguage.Name)}
{this.inputText}
""";
@@ -215,11 +215,11 @@
</MudStack>
<ProfileFormSelection @bind-Profile="@this.editor.Profile" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.editor.TargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="true" @bind-OtherInput="@this.editor.CustomTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomTargetLanguage" SelectionUpdated="@(_ => this.ScheduleFormValidation())" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceProfile" NameFunc="@(value => value.Name())" @bind-Value="@this.editor.AudienceProfile" Label="@T("Audience profile")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceAgeGroup" NameFunc="@(value => value.Name())" @bind-Value="@this.editor.AudienceAgeGroup" Label="@T("Audience age group")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceOrganizationalLevel" NameFunc="@(value => value.Name())" @bind-Value="@this.editor.AudienceOrganizationalLevel" Label="@T("Audience organizational level")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceExpertise" NameFunc="@(value => value.Name())" @bind-Value="@this.editor.AudienceExpertise" Label="@T("Audience expertise")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name)" @bind-Value="@this.editor.TargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="true" @bind-OtherInput="@this.editor.CustomTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomTargetLanguage" SelectionUpdated="@(_ => this.ScheduleFormValidation())" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceProfile" NameFunc="@(value => value.Name)" @bind-Value="@this.editor.AudienceProfile" Label="@T("Audience profile")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceAgeGroup" NameFunc="@(value => value.Name)" @bind-Value="@this.editor.AudienceAgeGroup" Label="@T("Audience age group")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceOrganizationalLevel" NameFunc="@(value => value.Name)" @bind-Value="@this.editor.AudienceOrganizationalLevel" Label="@T("Audience organizational level")" Disabled="@this.IsCurrentBusy"/>
<EnumSelection T="AudienceExpertise" NameFunc="@(value => value.Name)" @bind-Value="@this.editor.AudienceExpertise" Label="@T("Audience expertise")" Disabled="@this.IsCurrentBusy"/>
<MudSwitch T="bool" @bind-Value="@this.editor.ShowSourceReferences" Color="Color.Primary" Disabled="@this.IsCurrentBusy">@T("Show source references")</MudSwitch>
<MudSwitch T="bool" @bind-Value="@this.editor.OptimizeImages" Color="Color.Primary" Disabled="@this.IsCurrentBusy">@T("Optimize large visual assets")</MudSwitch>
</MudPaper>
@@ -147,7 +147,7 @@ public partial class VisualBriefingAssistant : MSGComponentBase
if (!this.SettingsManager.IsAssistantVisible(
ComponentKind.VISUAL_BRIEFING_ASSISTANT,
assistantName: T("Visual Briefing Assistant"),
requiredPreviewFeature: ComponentKind.VISUAL_BRIEFING_ASSISTANT.RequiredPreviewFeature()))
requiredPreviewFeature: ComponentKind.VISUAL_BRIEFING_ASSISTANT.RequiredPreviewFeature))
{
this.NavigationManager.NavigateTo(Routes.ASSISTANTS);
return;