using AIStudio.Tools.PluginSystem; namespace AIStudio.Provider; /// /// How messages to the user name a provider and its model, see IProvider.HidesIdentity. /// public static class ProviderIdentityExtensions { private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ProviderIdentityExtensions).Namespace, nameof(ProviderIdentityExtensions)); /// The provider of a request. extension(IProvider provider) { /// /// The name of the provider in a message to the user: its instance name, or a neutral word while it hides /// which provider it is. /// public string NameForUser => provider.HidesIdentity ? TB("hidden") : provider.InstanceName; /// /// The type of the provider in a message to the user, or a neutral word while it hides which provider it is. /// public string TypeForUser => provider.HidesIdentity ? TB("hidden") : provider.Provider.ToString(); /// /// Gets the name of a model in a message to the user, or a neutral word while the provider hides which /// provider it is. /// /// The model of the request. /// The name of the model to show. public string ModelNameForUser(Model model) => provider.HidesIdentity ? TB("hidden") : model.Id; } }