mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-27 02:53:38 +00:00
Fixed self-hosted providers hiding a failure to store their API key
This commit is contained in:
parent
d7b922219e
commit
5152eefef1
@ -49,16 +49,20 @@ public sealed class ProviderValidation
|
|||||||
|
|
||||||
public string? ValidatingAPIKey(string apiKey)
|
public string? ValidatingAPIKey(string apiKey)
|
||||||
{
|
{
|
||||||
if(this.GetProvider() is LLMProviders.SELF_HOSTED)
|
// A key which could not be stored in or removed from the operating system has to reach the
|
||||||
return null;
|
// 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();
|
var apiKeyStorageIssue = this.GetAPIKeyStorageIssue();
|
||||||
if(!string.IsNullOrWhiteSpace(apiKeyStorageIssue))
|
if(!string.IsNullOrWhiteSpace(apiKeyStorageIssue))
|
||||||
return 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))
|
if(string.IsNullOrWhiteSpace(apiKey))
|
||||||
return TB("Please enter an API key.");
|
return TB("Please enter an API key.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user