import { Group, TextInput, Button } from '@mantine/core'; import { File, Search } from 'lucide-react'; import { SectionHeader } from '@/components/SectionHeader'; import { getInputValidationState } from '@/utils'; import styles from '@/styles/layout.module.css'; interface ModelFileFieldProps { label: string; value: string; placeholder: string; tooltip?: string; onChange: (value: string) => void; onSelectFile: () => void; showSearchHF?: boolean; searchUrl?: string; } export const ModelFileField = ({ label, value, placeholder, tooltip, onChange, onSelectFile, showSearchHF = false, searchUrl = 'https://huggingface.co/models?pipeline_tag=text-to-image&library=gguf&sort=trending', }: ModelFileFieldProps) => { const validationState = getInputValidationState(value); const getHelperText = () => { if (!value.trim()) return undefined; if (validationState === 'invalid') { return 'Enter a valid URL or file path'; } return undefined; }; return (
onChange(event.currentTarget.value)} error={validationState === 'invalid' ? getHelperText() : undefined} />
{showSearchHF && ( )}
); };