diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs index bde93e45..1ed37e94 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs @@ -209,17 +209,10 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId if (this.DataLLMProvider is LLMProviders.SELF_HOSTED) this.dataManuallyModel = this.DataModel.Id; - // - // We cannot load the API key for self-hosted providers: - // - if (this.DataLLMProvider is LLMProviders.SELF_HOSTED && this.DataHost is not Host.OLLAMA && this.DataHost is not Host.VLLM) - { - await this.ReloadModels(); - await base.OnInitializedAsync(); - return; - } - - // Load the API key: + // 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). + // ReloadModels() below reads dataAPIKey, so the key has to be here before it runs: var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.EMBEDDING_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED); if (requestedSecret.Success) { diff --git a/app/MindWork AI Studio/Dialogs/ProviderDialog.razor.cs b/app/MindWork AI Studio/Dialogs/ProviderDialog.razor.cs index 993a5c7e..26666691 100644 --- a/app/MindWork AI Studio/Dialogs/ProviderDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/ProviderDialog.razor.cs @@ -264,17 +264,10 @@ public partial class ProviderDialog : MSGComponentBase, ISecretId if (this.DataLLMProvider.IsLLMModelProvidedManually()) this.dataManuallyModel = this.DataModel.Id; - // - // We cannot load the API key for self-hosted providers: - // - if (this.DataLLMProvider is LLMProviders.SELF_HOSTED && this.DataHost is not Host.OLLAMA && this.DataHost is not Host.VLLM) - { - await this.ReloadModels(); - await base.OnInitializedAsync(); - return; - } - - // Load the API key: + // 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). + // ReloadModels() below reads dataAPIKey, so the key has to be here before it runs: var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.LLM_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED); if (requestedSecret.Success) { diff --git a/app/MindWork AI Studio/Dialogs/TranscriptionProviderDialog.razor.cs b/app/MindWork AI Studio/Dialogs/TranscriptionProviderDialog.razor.cs index 872d45bc..1f3bc0de 100644 --- a/app/MindWork AI Studio/Dialogs/TranscriptionProviderDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/TranscriptionProviderDialog.razor.cs @@ -199,9 +199,10 @@ public partial class TranscriptionProviderDialog : MSGComponentBase, ISecretId if (this.DataLLMProvider is LLMProviders.SELF_HOSTED) this.dataManuallyModel = this.DataModel.Id; - // Load the API key. Self-hosted providers may or may not need one (e.g., VLLM behind - // an authenticated proxy does), so we always try -- ReloadModels() below relies on - // dataAPIKey already being populated, otherwise it would send an empty Bearer token: + // 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). + // ReloadModels() below reads dataAPIKey, so the key has to be here before it runs: var requestedSecret = await this.RustService.GetAPIKey(this, SecretStoreType.TRANSCRIPTION_PROVIDER, isTrying: this.DataLLMProvider is LLMProviders.SELF_HOSTED); if (requestedSecret.Success) {