import { AlertCircle } from 'lucide-react' import type { ApiSuccessOf } from '../lib/api-client' import { Button } from './ui/button' type HfAuthStatus = ApiSuccessOf<'getHuggingFaceAuthStatus'>['status'] type ModelAccessMap = ApiSuccessOf<'checkModelAccess'>['access'] interface HfModelAccessGateProps { accessMap: ModelAccessMap allAuthorized: boolean hfAuthStatus: HfAuthStatus hfAuthPolling: boolean startHuggingFaceLogin: () => void /** When the access check itself failed (network/backend), distinct from unauthorized. */ checkError?: string | null onRetryCheck?: () => void className?: string } export function HfModelAccessGate({ accessMap, allAuthorized, hfAuthStatus, hfAuthPolling, startHuggingFaceLogin, checkError = null, onRetryCheck, className, }: HfModelAccessGateProps) { if (allAuthorized) return null if (checkError) { return (
Accept the Hugging Face license for this model, then download.
{unauthorizedRepos.map(([repoId]) => (