mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-04-15 01:21:37 +00:00
19 lines
1.3 KiB
C#
19 lines
1.3 KiB
C#
|
|
using AIStudio.Tools.PluginSystem;
|
||
|
|
|
||
|
|
namespace AIStudio.Provider;
|
||
|
|
|
||
|
|
public static class ModelLoadFailureReasonExtensions
|
||
|
|
{
|
||
|
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ModelLoadFailureReasonExtensions).Namespace, nameof(ModelLoadFailureReasonExtensions));
|
||
|
|
|
||
|
|
public static string ToUserMessage(this ModelLoadFailureReason failureReason, string providerName) => failureReason switch
|
||
|
|
{
|
||
|
|
ModelLoadFailureReason.INVALID_OR_MISSING_API_KEY => string.Format(TB("We could not load models from '{0}'. The API key is probably missing, invalid, or expired."), providerName),
|
||
|
|
ModelLoadFailureReason.AUTHENTICATION_OR_PERMISSION_ERROR => string.Format(TB("We could not load models from '{0}'. The account or API key does not have the required permissions."), providerName),
|
||
|
|
ModelLoadFailureReason.PROVIDER_UNAVAILABLE => string.Format(TB("We could not load models from '{0}' because the provider is currently unavailable or could not be reached."), providerName),
|
||
|
|
ModelLoadFailureReason.INVALID_RESPONSE => string.Format(TB("We could not load models from '{0}' because the provider returned an unexpected response."), providerName),
|
||
|
|
ModelLoadFailureReason.UNKNOWN => string.Format(TB("We could not load models from '{0}' due to an unknown error."), providerName),
|
||
|
|
|
||
|
|
_ => string.Empty,
|
||
|
|
};
|
||
|
|
}
|