From 5152eefef18869ae3e6f8888c215ad4326d4a013 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 16 Sep 2026 18:46:27 +0200 Subject: [PATCH] Fixed self-hosted providers hiding a failure to store their API key --- .../Tools/Validation/ProviderValidation.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/MindWork AI Studio/Tools/Validation/ProviderValidation.cs b/app/MindWork AI Studio/Tools/Validation/ProviderValidation.cs index 3db0418f..10b775e6 100644 --- a/app/MindWork AI Studio/Tools/Validation/ProviderValidation.cs +++ b/app/MindWork AI Studio/Tools/Validation/ProviderValidation.cs @@ -49,16 +49,20 @@ public sealed class ProviderValidation public string? ValidatingAPIKey(string apiKey) { - if(this.GetProvider() is LLMProviders.SELF_HOSTED) - return null; - + // A key which could not be stored in or removed from the operating system has to reach the + // user for every provider. Self-hosted providers are exempt from having to name a key at + // all, not from being told that the one they named was lost on the way: var apiKeyStorageIssue = this.GetAPIKeyStorageIssue(); if(!string.IsNullOrWhiteSpace(apiKeyStorageIssue)) return apiKeyStorageIssue; + // A self-hosted server may well run without any key, so an empty field is fine for it: + if(this.GetProvider() is LLMProviders.SELF_HOSTED) + return null; + if(string.IsNullOrWhiteSpace(apiKey)) return TB("Please enter an API key."); - + return null; }