Recognize the embedding models whose name does not say so

This commit is contained in:
Thorsten Sommer committed 2026-09-19 15:18:28 +02:00
1 parent ace20e434a
commit 5cef42a756
4 files changed
+59 -1

No files matched your search

@@ -115,6 +115,12 @@
@T("This server does not offer the selected model right now. It stays selected, so the documents you already prepared keep working. Choosing another model means every document of the data sources behind this provider is prepared again.")
</MudAlert>
}
@if (this.ServerNamedNoEmbeddingModel)
{
<MudAlert Severity="Severity.Info" Class="mt-3">
@T("Your server answered, but none of the models it serves is one we know to create embeddings. Either there is none installed, or it runs under a name we do not recognize. In the latter case, your organization can describe the model in a model plugin, and it will show up here.")
</MudAlert>
}
@if (!string.IsNullOrWhiteSpace(this.dataLoadingModelsIssue))
{
<MudAlert Severity="Severity.Error" Class="mt-3">
@@ -137,6 +137,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
private string dataEditingPreviousInstanceName = string.Empty;
private string dataLoadingModelsIssue = string.Empty;
private bool dataConfiguredModelIsNotOffered;
private bool dataServerWasAskedForItsModels;
private string dataFilePath = string.Empty;
private string dataTokenizerFingerprint = string.Empty;
private string dataCustomTokenizerValidationIssue = string.Empty;
@@ -517,6 +518,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
private async Task ReloadModels()
{
this.dataLoadingModelsIssue = string.Empty;
this.dataServerWasAskedForItsModels = true;
var currentEmbeddingProviderSettings = this.CreateEmbeddingProviderSettings();
var provider = currentEmbeddingProviderSettings.CreateProvider();
if (provider is NoProvider)
@@ -573,6 +575,23 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
this.availableModels.Insert(0, this.DataModel);
}
/// <summary>
/// Whether the server answered without naming a single embedding model.
/// </summary>
/// <remarks>
/// Two situations end up here, and the user is the only one who can tell them apart: a server
/// running no embedding model at all, and one running an embedding model under a name no rule
/// covers. Saying so beats the bare "No models loaded or available.", which reads like a
/// failure and leaves nobody anywhere to go -- the field for typing a name is gone, on purpose.
/// Describing such a model in a model plugin is the way out, and naming it here is what turns
/// a dead end into one.
/// </remarks>
private bool ServerNamedNoEmbeddingModel =>
this.DataLLMProvider is LLMProviders.SELF_HOSTED &&
this.dataServerWasAskedForItsModels &&
string.IsNullOrWhiteSpace(this.dataLoadingModelsIssue) &&
this.availableModels.Count is 0;
private string APIKeyText => this.DataLLMProvider switch
{
LLMProviders.SELF_HOSTED => T("(Optional) API Key"),