Enhanced formatting

This commit is contained in:
Thorsten Sommer 2025-11-13 15:49:10 +01:00
parent 5eeebe6887
commit 12e27d7b65
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 17 additions and 6 deletions

View File

@ -131,15 +131,17 @@
/> />
<MudStack> <MudStack>
<MudButton OnClick="@this.ToggleProviderExpertSettings">@(this.showExpertProviderSettings ? @T("Hide Expert Settings") : @T("Show Expert Settings"))</MudButton> <MudButton OnClick="@this.ToggleProviderExpertSettings">
@(this.showExpertProviderSettings ? @T("Hide Expert Settings") : @T("Show Expert Settings"))
</MudButton>
<MudDivider /> <MudDivider />
<MudCollapse Expanded="@this.showExpertProviderSettings"> <MudCollapse Expanded="@this.showExpertProviderSettings" Class="@this.GetExpertStyles">
<MudJustifiedText>@T("Please be aware: This is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call.")</MudJustifiedText> <MudJustifiedText Class="mb-5">
<MudJustifiedText>@T("By default, AI Studio uses the OpenAI-compatible chat/completions API, provided that it is supported by the underlying service and model.")</MudJustifiedText> @T("Please be aware: This section is for experts only. You are responsible for verifying the correctness of the additional parameters you provide to the API call. By default, AI Studio uses the OpenAI-compatible chat completions API, when that it is supported by the underlying service and model.")
<MudTextField T="string" Label=@T("Additional API parameters") Variant="Variant.Outlined" Lines="3" AutoGrow="true" HelperText=@T("Add the parameters in proper json formatting, e.g., \"temperature\": 0.5. Remove trailing commas.") HelperTextOnFocus="true " @bind-Value="@ExpertProviderApiParameters" OnBlur="@OnInputChangeExpertSettings"></MudTextField> </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.ExpertProviderApiParameters" OnBlur="@this.OnInputChangeExpertSettings"/>
</MudCollapse> </MudCollapse>
</MudStack> </MudStack>
</MudForm> </MudForm>
<Issues IssuesData="@this.dataIssues"/> <Issues IssuesData="@this.dataIssues"/>
</DialogContent> </DialogContent>

View File

@ -285,4 +285,13 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
{ {
this.ExpertProviderApiParameters = this.ExpertProviderApiParameters.TrimEnd(',', ' '); this.ExpertProviderApiParameters = this.ExpertProviderApiParameters.TrimEnd(',', ' ');
} }
private string GetExpertStyles => this.showExpertProviderSettings ? "border-2 border-dashed rounded pa-2" : string.Empty;
private static string GetPlaceholderExpertSettings =>
"""
"temperature": 0.5,
"top_p": 0.9,
"frequency_penalty": 0.0
""";
} }