Fixed the dialog for adding providers

This commit is contained in:
Thorsten Sommer 2026-07-06 15:15:36 +02:00
parent 5ea2d35dcd
commit cac401f563
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
4 changed files with 58 additions and 36 deletions

View File

@ -7,7 +7,15 @@
<MudForm @ref="@this.form" @bind-IsValid="@this.dataIsValid" @bind-Errors="@this.dataIssues">
<MudStack Row="@true" AlignItems="AlignItems.Center">
@* ReSharper disable once CSharpWarnings::CS8974 *@
<MudSelect @bind-Value="@this.DataLLMProvider" Label="@T("Provider")" Class="mb-3" OpenIcon="@Icons.Material.Filled.AccountBalance" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingProvider">
<MudSelect T="LLMProviders"
Value="@this.DataLLMProvider"
ValueChanged="@this.OnProviderChanged"
Label="@T("Provider")"
Class="mb-3"
OpenIcon="@Icons.Material.Filled.AccountBalance"
AdornmentColor="Color.Info"
Adornment="Adornment.Start"
Validation="@this.providerValidation.ValidatingProvider">
@foreach (LLMProviders provider in Enum.GetValues(typeof(LLMProviders)))
{
<MudSelectItem Value="@provider">

View File

@ -162,28 +162,13 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
{
var cleanedHostname = this.DataHostname.Trim();
// Determine the model based on the provider and host configuration:
Model model;
if (this.IsLLMModelSelectionHidden)
{
// Use system model placeholder for legacy hosts that don't support model selection:
model = Model.SYSTEM_MODEL;
}
else if (this.DataLLMProvider is LLMProviders.FIREWORKS or LLMProviders.HUGGINGFACE)
{
// These providers require manual model entry:
model = new Model(this.dataManuallyModel, null);
}
else
model = this.DataModel;
return new()
{
Num = this.DataNum,
Id = this.DataId,
InstanceName = this.DataInstanceName,
UsedLLMProvider = this.DataLLMProvider,
Model = model,
Model = this.GetSelectedModel(),
IsSelfHosted = this.DataLLMProvider is LLMProviders.SELF_HOSTED,
IsEnterpriseConfiguration = false,
Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname,
@ -194,6 +179,17 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
};
}
private Model GetSelectedModel()
{
if (this.IsLLMModelSelectionHidden)
return Model.SYSTEM_MODEL;
if (this.DataLLMProvider.IsLLMModelProvidedManually())
return new Model(this.dataManuallyModel, null);
return this.DataModel;
}
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
@ -326,6 +322,17 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
}
}
private void OnProviderChanged(LLMProviders selectedProvider)
{
this.DataLLMProvider = selectedProvider;
this.DataModel = default;
this.dataManuallyModel = string.Empty;
this.capabilityOverrides = new();
this.availableModels.Clear();
this.dataLoadingModelsIssue = string.Empty;
this.usesLegacySystemModelFallback = false;
}
private void OnHostChanged(Host selectedHost)
{
// When the host changes, reset the model selection state:
@ -535,7 +542,7 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId
return currentProviderSettings.GetModelCapabilities();
}
private List<Capability> GetAutomaticModelCapabilities() => this.DataLLMProvider.GetModelCapabilities(this.DataModel);
private List<Capability> GetAutomaticModelCapabilities() => this.DataLLMProvider.GetModelCapabilities(this.GetSelectedModel());
private string GetCurrentModelApiLabel()
{

View File

@ -21,27 +21,33 @@ public static partial class ProviderExtensions
/// <param name="provider">The LLM provider.</param>
/// <param name="model">The model to get the capabilities for.</param>
/// <returns>>The capabilities of the model.</returns>
public static List<Capability> GetModelCapabilities(this LLMProviders provider, Model model) => provider switch
public static List<Capability> GetModelCapabilities(this LLMProviders provider, Model model)
{
LLMProviders.OPEN_AI => GetModelCapabilitiesOpenAI(model),
LLMProviders.MISTRAL => GetModelCapabilitiesMistral(model),
LLMProviders.ANTHROPIC => GetModelCapabilitiesAnthropic(model),
LLMProviders.GOOGLE => GetModelCapabilitiesGoogle(model),
LLMProviders.X => GetModelCapabilitiesOpenSource(model),
LLMProviders.DEEP_SEEK => GetModelCapabilitiesDeepSeek(model),
LLMProviders.ALIBABA_CLOUD => GetModelCapabilitiesAlibaba(model),
LLMProviders.PERPLEXITY => GetModelCapabilitiesPerplexity(model),
LLMProviders.OPEN_ROUTER => GetModelCapabilitiesOpenRouter(model),
if (string.IsNullOrWhiteSpace(model.Id))
return [];
LLMProviders.GROQ => GetModelCapabilitiesOpenSource(model),
LLMProviders.FIREWORKS => GetModelCapabilitiesOpenSource(model),
LLMProviders.HUGGINGFACE => GetModelCapabilitiesOpenSource(model),
return provider switch
{
LLMProviders.OPEN_AI => GetModelCapabilitiesOpenAI(model),
LLMProviders.MISTRAL => GetModelCapabilitiesMistral(model),
LLMProviders.ANTHROPIC => GetModelCapabilitiesAnthropic(model),
LLMProviders.GOOGLE => GetModelCapabilitiesGoogle(model),
LLMProviders.X => GetModelCapabilitiesOpenSource(model),
LLMProviders.DEEP_SEEK => GetModelCapabilitiesDeepSeek(model),
LLMProviders.ALIBABA_CLOUD => GetModelCapabilitiesAlibaba(model),
LLMProviders.PERPLEXITY => GetModelCapabilitiesPerplexity(model),
LLMProviders.OPEN_ROUTER => GetModelCapabilitiesOpenRouter(model),
LLMProviders.GROQ => GetModelCapabilitiesOpenSource(model),
LLMProviders.FIREWORKS => GetModelCapabilitiesOpenSource(model),
LLMProviders.HUGGINGFACE => GetModelCapabilitiesOpenSource(model),
LLMProviders.HELMHOLTZ => GetModelCapabilitiesOpenSource(model),
LLMProviders.GWDG => GetModelCapabilitiesOpenSource(model),
LLMProviders.HELMHOLTZ => GetModelCapabilitiesOpenSource(model),
LLMProviders.GWDG => GetModelCapabilitiesOpenSource(model),
LLMProviders.SELF_HOSTED => GetModelCapabilitiesOpenSource(model),
LLMProviders.SELF_HOSTED => GetModelCapabilitiesOpenSource(model),
_ => []
};
_ => []
};
}
}

View File

@ -1 +1,2 @@
# v26.7.2, build 244 (2026-07-xx xx:xx UTC)
- Fixed the dialog for adding providers. Selecting an option could previously prevent the setup from continuing. Thanks, Dominic Neuburg (`donework`), for reporting this issue.