2026-06-15 00:40:35 +09:00
|
|
|
import { Cloud, Server, Sparkles } from "lucide-react"
|
2026-10-12 21:31:03 +09:00
|
|
|
import { PROVIDERS, type ProviderName } from "@/lib/providers"
|
2026-06-15 00:40:35 +09:00
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
|
|
2026-10-12 21:31:03 +09:00
|
|
|
const ICONS = { cloud: Cloud, server: Server, sparkles: Sparkles }
|
|
|
|
|
|
|
|
|
|
// Provider logo from models.dev, or the record's Lucide icon for providers
|
2026-06-15 00:40:35 +09:00
|
|
|
// that have no logo there
|
|
|
|
|
export function ProviderLogo({
|
|
|
|
|
provider,
|
|
|
|
|
className,
|
|
|
|
|
}: {
|
|
|
|
|
provider: ProviderName
|
|
|
|
|
className?: string
|
|
|
|
|
}) {
|
2026-10-12 21:31:03 +09:00
|
|
|
const { icon, logo } = PROVIDERS[provider]
|
|
|
|
|
if (icon) {
|
|
|
|
|
const Icon = ICONS[icon]
|
|
|
|
|
return <Icon className={cn("size-4", className)} />
|
2026-06-15 00:40:35 +09:00
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
// biome-ignore lint/performance/noImgElement: External URL from models.dev
|
|
|
|
|
<img
|
|
|
|
|
alt=""
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
className={cn("size-4 dark:invert", className)}
|
|
|
|
|
height={16}
|
2026-10-12 21:31:03 +09:00
|
|
|
src={`https://models.dev/logos/${logo ?? provider}.svg`}
|
2026-06-15 00:40:35 +09:00
|
|
|
width={16}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|