Provider dialog shows the relevant fields dynamically

This commit is contained in:
Peer Schütt 2025-04-11 13:54:03 +02:00
parent 74fa1d14a6
commit ca7d82a220
2 changed files with 39 additions and 29 deletions

View File

@ -29,7 +29,7 @@
<RowTemplate> <RowTemplate>
<MudTd>@context.Num</MudTd> <MudTd>@context.Num</MudTd>
<MudTd>@context.InstanceName</MudTd> <MudTd>@context.InstanceName</MudTd>
<MudTd>@context.UsedLLMProvider</MudTd> <MudTd>@context.UsedLLMProvider.ToName()</MudTd>
<MudTd> <MudTd>
@if (context.UsedLLMProvider is not LLMProviders.SELF_HOSTED) @if (context.UsedLLMProvider is not LLMProviders.SELF_HOSTED)
{ {

View File

@ -30,32 +30,42 @@
Validation="@this.providerValidation.ValidatingAPIKey" Validation="@this.providerValidation.ValidatingAPIKey"
/> />
<MudTextField @if (this.DataLLMProvider.IsHostnameNeeded())
T="string" {
@bind-Text="@this.DataHostname" <MudTextField
Label="Hostname" T="string"
Disabled="@(!this.DataLLMProvider.IsHostnameNeeded())" @bind-Text="@this.DataHostname"
Class="mb-3" Label="Hostname"
Adornment="Adornment.Start" Disabled="@(!this.DataLLMProvider.IsHostnameNeeded())"
AdornmentIcon="@Icons.Material.Filled.Dns" Class="mb-3"
AdornmentColor="Color.Info" Adornment="Adornment.Start"
Validation="@this.providerValidation.ValidatingHostname" AdornmentIcon="@Icons.Material.Filled.Dns"
UserAttributes="@SPELLCHECK_ATTRIBUTES" AdornmentColor="Color.Info"
/> Validation="@this.providerValidation.ValidatingHostname"
UserAttributes="@SPELLCHECK_ATTRIBUTES"/>
}
<MudSelect Disabled="@(!this.DataLLMProvider.IsHostNeeded())" @bind-Value="@this.DataHost" Label="Host" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHost"> @if (this.DataLLMProvider.IsHostNeeded())
@foreach (Host host in Enum.GetValues(typeof(Host))) {
{ <MudSelect Disabled="@(!this.DataLLMProvider.IsHostNeeded())" @bind-Value="@this.DataHost" Label="Host" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHost">
<MudSelectItem Value="@host">@host.Name()</MudSelectItem> @foreach (Host host in Enum.GetValues(typeof(Host)))
} {
</MudSelect> <MudSelectItem Value="@host">@host.Name()</MudSelectItem>
}
</MudSelect>
}
<MudSelect Disabled="@(!this.DataLLMProvider.IsHFInstanceProviderNeeded())" @bind-Value="@this.HfInstanceProviderId" Label="HF Instance Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider"> @if (this.DataLLMProvider.IsHFInstanceProviderNeeded())
@foreach (HFInstanceProvider instanceProvider in Enum.GetValues(typeof(HFInstanceProvider))) {
{ <MudSelect Disabled="@(!this.DataLLMProvider.IsHFInstanceProviderNeeded())" @bind-Value="@this.HfInstanceProviderId" Label="HF Instance Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider">
<MudSelectItem Value="@instanceProvider">@instanceProvider.ToName()</MudSelectItem> @foreach (HFInstanceProvider instanceProvider in Enum.GetValues(typeof(HFInstanceProvider)))
} {
</MudSelect> <MudSelectItem Value="@instanceProvider">@instanceProvider.ToName()</MudSelectItem>
}
</MudSelect>
<MudJustifiedText Class="mb-3"> Please double-check if your model name matches the curl specifications provided by the instance provider. If it doesn't, you might get a <b>Not Found</b> error when trying to use the model. Here's a <MudLink Href="https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct?inference_api=true&inference_provider=novita&language=sh" Target="_blank">curl example</MudLink>.</MudJustifiedText>
}
<MudStack Row="@true" AlignItems="AlignItems.Center"> <MudStack Row="@true" AlignItems="AlignItems.Center">
@if (this.DataLLMProvider.IsLLMModelProvidedManually()) @if (this.DataLLMProvider.IsLLMModelProvidedManually())
@ -67,7 +77,7 @@
Label="Model" Label="Model"
Class="mb-3" Class="mb-3"
Adornment="Adornment.Start" Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Dns" AdornmentIcon="@Icons.Material.Filled.FaceRetouchingNatural"
AdornmentColor="Color.Info" AdornmentColor="Color.Info"
Validation="@this.ValidateManuallyModel" Validation="@this.ValidateManuallyModel"
UserAttributes="@SPELLCHECK_ATTRIBUTES" UserAttributes="@SPELLCHECK_ATTRIBUTES"