({
failed_model_id,
mutationToUse,
}: {
failed_model_id: string
mutationToUse: UseMutationResult<
undefined,
Error,
{ id_to_resolve: string; url: string; type: string },
unknown
>
})
| 9 | import { Button } from './ui/button' |
| 10 | |
| 11 | function ImportURLUI({ |
| 12 | failed_model_id, |
| 13 | mutationToUse, |
| 14 | }: { |
| 15 | failed_model_id: string |
| 16 | mutationToUse: UseMutationResult< |
| 17 | undefined, |
| 18 | Error, |
| 19 | { id_to_resolve: string; url: string; type: string }, |
| 20 | unknown |
| 21 | > |
| 22 | }) { |
| 23 | const [modelURLToImport, setModelURLToImport] = useState('') |
| 24 | const [modelTypeToImport, setModelTypeToImport] = useState< |
| 25 | 'hf' | 'civit' | 'custom' |
| 26 | >('hf') |
| 27 | const [importLoading, setImportLoading] = useState(false) |
| 28 | |
| 29 | const morphingPlaceholder = () => { |
| 30 | if (modelTypeToImport === 'hf') { |
| 31 | return 'https://huggingface.co/h94/IP-Adapter-FaceID/blob/main/ip-adapter-faceid_sd15_lora.safetensors' |
| 32 | } else if (modelTypeToImport === 'civit') { |
| 33 | return 'https://civitai.com/models/4201/realistic-vision-v60-b1?modelVersionId=130072' |
| 34 | } else { |
| 35 | return 'custom.com' |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | return ( |
| 40 | <div className="w-full flex flex-col items-start gap-2"> |
| 41 | <div className="flex flex-row items-center gap-2"> |
| 42 | <Import className="w-4 h-4 text-green-400" /> |
| 43 | <p className="text-white font-semibold">Or import from URL</p> |
| 44 | </div> |
| 45 | <div className="flex flex-row items-center space-x-4"> |
| 46 | <RadioGroup |
| 47 | className="flex flex-row" |
| 48 | defaultValue="hf" |
| 49 | onValueChange={(currentValue) => { |
| 50 | if ( |
| 51 | currentValue === 'hf' || |
| 52 | currentValue === 'civit' || |
| 53 | currentValue === 'custom' |
| 54 | ) { |
| 55 | setModelTypeToImport(currentValue) |
| 56 | } |
| 57 | }} |
| 58 | > |
| 59 | <div className="flex items-center space-x-2"> |
| 60 | <RadioGroupItem |
| 61 | className="text-white border-white" |
| 62 | value="hf" |
| 63 | id="r1" |
| 64 | /> |
| 65 | <Label className="text-white" htmlFor="r1"> |
| 66 | Hugging Face |
| 67 | </Label> |
| 68 | </div> |
nothing calls this directly
no test coverage detected