diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor index 26ceeb33..ec7f5ee9 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor +++ b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor @@ -85,46 +85,28 @@ - @if (this.DataLLMProvider.IsEmbeddingModelProvidedManually(this.DataHost)) + + @T("Load") + + @if (this.availableModels.Count is 0) { - + + @T("No models loaded or available.") + } else { - - @T("Load") - - @if (this.availableModels.Count is 0) - { - - @T("No models loaded or available.") - - } - else - { - - @foreach (var model in this.availableModels) - { - - @model - - } - - } + + @foreach (var model in this.availableModels) + { + + @model + + } + } @if (!string.IsNullOrWhiteSpace(this.dataLoadingModelsIssue)) diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs index 03479185..21aa6eed 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs @@ -133,7 +133,6 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId private string[] dataIssues = []; private string dataAPIKey = string.Empty; private bool dataHadStoredAPIKeyOnLoad; - private string dataManuallyModel = string.Empty; private string dataAPIKeyStorageIssue = string.Empty; private string dataEditingPreviousInstanceName = string.Empty; private string dataLoadingModelsIssue = string.Empty; @@ -162,7 +161,6 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId GetPreviousInstanceName = () => this.dataEditingPreviousInstanceName, GetUsedInstanceNames = () => this.UsedInstanceNames, GetHost = () => this.DataHost, - IsModelProvidedManually = () => this.DataLLMProvider.IsEmbeddingModelProvidedManually(this.DataHost), GetCustomTokenizerValidationIssue = () => this.dataCustomTokenizerValidationIssue, }; } @@ -170,24 +168,13 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId private EmbeddingProvider CreateEmbeddingProviderSettings() { var cleanedHostname = this.DataHostname.Trim(); - Model model = default; - if(this.DataLLMProvider is LLMProviders.SELF_HOSTED) - { - if (this.DataLLMProvider.IsEmbeddingModelProvidedManually(this.DataHost)) - model = new Model(this.dataManuallyModel, null); - else if (this.DataHost is Host.LM_STUDIO) - model = this.DataModel; - } - else - model = this.DataModel; - return new() { Num = this.DataNum, Id = this.DataId, Name = this.DataName, UsedLLMProvider = this.DataLLMProvider, - Model = model, + Model = this.DataModel, IsSelfHosted = this.DataLLMProvider is LLMProviders.SELF_HOSTED, Hostname = cleanedHostname.EndsWith('/') ? cleanedHostname[..^1] : cleanedHostname, Host = this.DataHost, @@ -225,10 +212,6 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId || this.DataTokenLimit != EmbeddingProvider.DEFAULT_TOKEN_LIMIT || this.DataEmbeddingBatchSize != EmbeddingProvider.DEFAULT_EMBEDDING_BATCH_SIZE; - // When using self-hosted embedding, we must copy the model name: - if (this.DataLLMProvider is LLMProviders.SELF_HOSTED) - this.dataManuallyModel = this.DataModel.Id; - // Load the API key. A self-hosted server may well need one: LM Studio can ask for a // token of its own, and any of these servers can sit behind an authenticating proxy. // So we try for every host and treat a missing key as the normal case (isTrying). @@ -358,14 +341,6 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId this.MudDialog.Close(DialogResult.Ok(addedProviderSettings)); } - private string? ValidateManuallyModel(string manuallyModel) - { - if (this.DataLLMProvider is LLMProviders.SELF_HOSTED && string.IsNullOrWhiteSpace(manuallyModel)) - return T("Please enter an embedding model name."); - - return null; - } - private string? ValidateTokenLimit(int tokenLimit) { if (tokenLimit < 1) @@ -516,7 +491,6 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId // When the host changes, reset the model selection state: this.DataHost = selectedHost; this.DataModel = default; - this.dataManuallyModel = string.Empty; this.availableModels.Clear(); this.dataLoadingModelsIssue = string.Empty; } diff --git a/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs b/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs index a7992cb2..4f01c430 100644 --- a/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs +++ b/app/MindWork AI Studio/Provider/LLMProvidersExtensions.cs @@ -421,12 +421,6 @@ public static class LLMProvidersExtensions _ => false, }; - public static bool IsEmbeddingModelProvidedManually(this LLMProviders provider, Host host) => provider switch - { - LLMProviders.SELF_HOSTED => host is not Host.LM_STUDIO, - _ => false, - }; - public static bool IsTranscriptionModelProvidedManually(this LLMProviders provider, Host host) => provider switch { _ => false,