Improve the provider dialog (#420)
Some checks are pending
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer 2025-04-24 11:43:16 +02:00 committed by GitHub
parent 69fc4d764f
commit bafd62429d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 28 deletions

View File

@ -30,6 +30,7 @@
AdornmentIcon="@Icons.Material.Filled.VpnKey" AdornmentIcon="@Icons.Material.Filled.VpnKey"
AdornmentColor="Color.Info" AdornmentColor="Color.Info"
InputType="InputType.Password" InputType="InputType.Password"
Immediate="true"
Validation="@this.providerValidation.ValidatingAPIKey"/> Validation="@this.providerValidation.ValidatingAPIKey"/>
} }
@ -61,7 +62,7 @@
@if (this.DataLLMProvider.IsHFInstanceProviderNeeded()) @if (this.DataLLMProvider.IsHFInstanceProviderNeeded())
{ {
<MudSelect Disabled="@(!this.DataLLMProvider.IsHFInstanceProviderNeeded())" @bind-Value="@this.HFInferenceProviderId" Label="HF Inference Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider"> <MudSelect @bind-Value="@this.HFInferenceProviderId" Label="Hugging Face Inference Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHFInstanceProvider">
@foreach (HFInferenceProvider inferenceProvider in Enum.GetValues(typeof(HFInferenceProvider))) @foreach (HFInferenceProvider inferenceProvider in Enum.GetValues(typeof(HFInferenceProvider)))
{ {
<MudSelectItem Value="@inferenceProvider"> <MudSelectItem Value="@inferenceProvider">
@ -73,33 +74,49 @@
<MudJustifiedText Class="mb-3"> Please double-check if your model name matches the curl specifications provided by the inference 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> <MudJustifiedText Class="mb-3"> Please double-check if your model name matches the curl specifications provided by the inference 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"> <MudField FullWidth="true" Label="Model selection" Variant="Variant.Outlined" Class="mb-3">
@if (this.DataLLMProvider.IsLLMModelProvidedManually()) <MudStack Row="@true" AlignItems="AlignItems.Center" StretchItems="StretchItems.End">
{ @if (this.DataLLMProvider.IsLLMModelProvidedManually())
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL(this.HFInferenceProviderId)" Target="_blank">Show available models</MudButton> {
<MudTextField <MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetModelsOverviewURL(this.HFInferenceProviderId)" Target="_blank">
T="string" Show available models
@bind-Text="@this.dataManuallyModel" </MudButton>
Label="Model" <MudTextField
Class="mb-3" T="string"
Adornment="Adornment.Start" @bind-Text="@this.dataManuallyModel"
AdornmentIcon="@Icons.Material.Filled.FaceRetouchingNatural" Label="Model"
AdornmentColor="Color.Info" Adornment="Adornment.Start"
Validation="@this.ValidateManuallyModel" AdornmentIcon="@Icons.Material.Filled.FaceRetouchingNatural"
UserAttributes="@SPELLCHECK_ATTRIBUTES" AdornmentColor="Color.Info"
/> Validation="@this.ValidateManuallyModel"
} UserAttributes="@SPELLCHECK_ATTRIBUTES"
else />
{ }
<MudButton Disabled="@(!this.DataLLMProvider.CanLoadModels(this.DataHost, this.dataAPIKey))" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">Load</MudButton> else
<MudSelect Disabled="@this.IsNoneProvider" @bind-Value="@this.DataModel" Label="Model" Class="mb-3" OpenIcon="@Icons.Material.Filled.FaceRetouchingNatural" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingModel"> {
@foreach (var model in this.availableModels) <MudButton Disabled="@(!this.DataLLMProvider.CanLoadModels(this.DataHost, this.dataAPIKey))" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">
Load models
</MudButton>
@if(this.availableModels.Count is 0)
{ {
<MudSelectItem Value="@model">@model</MudSelectItem> <MudText Typo="Typo.body1">
No models loaded or available.
</MudText>
} }
</MudSelect> else
} {
</MudStack> <MudSelect @bind-Value="@this.DataModel"
OpenIcon="@Icons.Material.Filled.FaceRetouchingNatural" AdornmentColor="Color.Info"
Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingModel">
@foreach (var model in this.availableModels)
{
<MudSelectItem Value="@model">@model</MudSelectItem>
}
</MudSelect>
}
}
</MudStack>
</MudField>
@* ReSharper disable once CSharpWarnings::CS8974 *@ @* ReSharper disable once CSharpWarnings::CS8974 *@
<MudTextField <MudTextField

View File

@ -272,6 +272,4 @@ public partial class ProviderDialog : ComponentBase, ISecretId
LLMProviders.SELF_HOSTED => "(Optional) API Key", LLMProviders.SELF_HOSTED => "(Optional) API Key",
_ => "API Key", _ => "API Key",
}; };
private bool IsNoneProvider => this.DataLLMProvider is LLMProviders.NONE;
} }

View File

@ -3,4 +3,5 @@
- Changed the terminology from "temporary chats" to "disappearing chats" in the UI. This makes it clearer to understand the purpose of these chats. - Changed the terminology from "temporary chats" to "disappearing chats" in the UI. This makes it clearer to understand the purpose of these chats.
- Improved the hot reloading of the plugin system to prevent overlapping reloads. - Improved the hot reloading of the plugin system to prevent overlapping reloads.
- Improved the app behavior when the user system was waked up from sleep mode. - Improved the app behavior when the user system was waked up from sleep mode.
- Improved the provider dialog with better input handling for API keys and an optimized model selection.
- Fixed the color for the update notification button to match the color theme. - Fixed the color for the update notification button to match the color theme.