import React from "react"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { useInstallExtra } from "@/hooks/useInstallExtra"; import { InstallProgress, InstallTitleIcon, RestartInstructions, installTitle, } from "./InstallProgress"; interface Props { open: boolean; onOpenChange: (open: boolean) => void; policyType: string; packageName: string; // the probed module, e.g. "transformers" installTarget: string; // e.g. "lerobot[smolvla]" installHint: string; // e.g. "pip install 'lerobot[smolvla]'" } // Some policies (smolvla, pi0, pi0_fast, diffusion) need an optional LeRobot // extra. This catches the missing package before training starts and offers a // one-click install, instead of the run dying with a buried ImportError. const PolicyExtraDialog: React.FC = ({ open, onOpenChange, policyType, packageName, installTarget, installHint, }) => { const install = useInstallExtra(`system/policy-extra/${policyType}`, open); const title = `${policyType.toUpperCase()} needs an extra package`; return ( {installTitle(install.state, title)} Install {installTarget} to train {policyType}.
Training a {policyType} policy needs the{" "} {packageName}{" "} package (installed via{" "} {installTarget}), which isn't in this environment yet. Install it to train this policy. } doneDescription={} />
); }; export default PolicyExtraDialog;