import { Stack, Text, Group, TextInput, Button, Select } from '@mantine/core'; import { useState } from 'react'; import { File, Search } from 'lucide-react'; import { InfoTooltip } from '@/components/InfoTooltip'; import { getInputValidationState, IMAGE_MODEL_PRESETS } from '@/utils'; import styles from '@/styles/layout.module.css'; interface ImageGenerationTabProps { sdmodel: string; sdt5xxl: string; sdclipl: string; sdclipg: string; sdphotomaker: string; sdvae: string; sdlora: string; onSdmodelChange: (path: string) => void; onSelectSdmodelFile: () => void; onSdt5xxlChange: (path: string) => void; onSelectSdt5xxlFile: () => void; onSdcliplChange: (path: string) => void; onSelectSdcliplFile: () => void; onSdclipgChange: (path: string) => void; onSelectSdclipgFile: () => void; onSdphotomakerChange: (path: string) => void; onSelectSdphotomakerFile: () => void; onSdvaeChange: (path: string) => void; onSelectSdvaeFile: () => void; onSdloraChange: (path: string) => void; onSelectSdloraFile: () => void; onApplyPreset: (presetName: string) => void; } const ModelField = ({ label, value, placeholder, tooltip, onChange, onSelectFile, showSearchHF = false, }: { label: string; value: string; placeholder: string; tooltip?: string; onChange: (value: string) => void; onSelectFile: () => void; showSearchHF?: boolean; }) => { const validationState = getInputValidationState(value); const getInputColor = () => { switch (validationState) { case 'valid': return 'green'; case 'invalid': return 'red'; default: return undefined; } }; const getHelperText = () => { if (!value.trim()) return undefined; if (validationState === 'invalid') { return 'Enter a valid URL or file path'; } return undefined; }; return (
{label} {tooltip && }
onChange(event.currentTarget.value)} color={getInputColor()} error={validationState === 'invalid' ? getHelperText() : undefined} />
{showSearchHF && ( )}
); }; export const ImageGenerationTab = ({ sdmodel, sdt5xxl, sdclipl, sdclipg, sdphotomaker, sdvae, sdlora, onSdmodelChange, onSelectSdmodelFile, onSdt5xxlChange, onSelectSdt5xxlFile, onSdcliplChange, onSelectSdcliplFile, onSdclipgChange, onSelectSdclipgFile, onSdphotomakerChange, onSelectSdphotomakerFile, onSdvaeChange, onSelectSdvaeFile, onSdloraChange, onSelectSdloraFile, onApplyPreset, }: ImageGenerationTabProps) => { const [selectedPreset, setSelectedPreset] = useState(null); return (
Model Preset