Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

900 B
Raw Blame
// --8<-- [start:CredentialsProviderNames]
// Helper function to convert provider names to display names
export function toDisplayName(provider: unknown): string {
  if (typeof provider !== "string" || provider.length === 0) return "";

  // Special cases that need manual handling
  const specialCases: Record<string, string> = {
    aiml_api: "AI/ML API",
    d_id: "D-ID",
    e2b: "E2B",
    llama_api: "Llama API",
    codex: "OpenAI",
    open_router: "Open Router",
    smtp: "SMTP",
    revid: "Rev.ID",
  };

  if (specialCases[provider]) {
    return specialCases[provider];
  }

  // General case: convert snake_case to Title Case
  return provider
    .split(/[_-]/)
    .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
    .join(" ");
}

// Provider display names are now generated dynamically by toDisplayName function
// --8<-- [end:CredentialsProviderNames]