import React, { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { NumberInput } from '@/components/ui/number-input'; import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { ConfigComponentProps } from '../types'; import DatasetCombobox from '@/components/replay/DatasetCombobox'; import { DatasetItem } from '@/lib/replayApi'; import WandbInstallDialog from '../WandbInstallDialog'; import { useApi } from '@/contexts/ApiContext'; interface EssentialsCardProps extends ConfigComponentProps { datasets: DatasetItem[]; datasetsLoading: boolean; } const EssentialsCard: React.FC = ({ config, updateConfig, datasets, datasetsLoading }) => { const { baseUrl, fetchWithHeaders } = useApi(); const [wandbDialogOpen, setWandbDialogOpen] = useState(false); const [wandbInstallHint, setWandbInstallHint] = useState('pip install wandb'); const handleWandbToggle = async (checked: boolean) => { if (!checked) { updateConfig('wandb_enable', false); return; } // Check availability before flipping the switch on. If wandb isn't // importable in this lelab process, surface the same install flow used // for the training extra (accelerate) instead of letting the user start // a run that will fail. try { const r = await fetchWithHeaders(`${baseUrl}/system/wandb-extra`); const data: { available: boolean; install_hint: string } = await r.json(); if (data.available) { updateConfig('wandb_enable', true); } else { setWandbInstallHint(data.install_hint); setWandbDialogOpen(true); } } catch { // Backend unreachable — let the user proceed; training start will // surface the real error if wandb is genuinely missing. updateConfig('wandb_enable', true); } }; return ( Run Configuration
{ if (repoId) updateConfig('dataset_repo_id', repoId); }} />

HuggingFace Hub dataset repository ID

{ if (v !== undefined) updateConfig('steps', v); }} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{ if (v !== undefined) updateConfig('batch_size', v); }} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{config.wandb_enable && (
updateConfig('wandb_project', e.target.value || undefined) } placeholder="my-robotics-project" className="bg-slate-900 border-slate-600 text-white rounded-lg" />
)}
); }; export default EssentialsCard;