import { ActionButton } from "../ui"; import { ModelToggleList, StatusBadge } from "../execution/ModelManagementShared"; import { OnboardingStep } from "./OnboardingStep"; import { useOnboardingConnectors, useOnboardingWizard, } from "./OnboardingContext"; interface ModelPoolStepProps { onBack: () => void; onContinue: () => void; } export function ModelPoolStep({ onBack, onContinue }: ModelPoolStepProps) { const { error, t } = useOnboardingWizard(); const { connectorModelPools, onToggleConnectorModel, onSetAllConnectorModels, selectedConnectorId, selectedConnectorEnabledModels, totalEnabledModels, } = useOnboardingConnectors(); const selectedConnectorIsRunnable = selectedConnectorEnabledModels > 0; const hasAnyEnabledModels = totalEnabledModels > 0; const canContinue = hasAnyEnabledModels && selectedConnectorIsRunnable; const readinessHint = !hasAnyEnabledModels ? t("onboarding.modelPoolGlobalRequirement") : !selectedConnectorIsRunnable ? t("onboarding.modelPoolSelectedConnectorRequirement") : t("onboarding.modelPoolContinueHint"); return (
{t("onboarding.modelPoolStepDescription")}
{connectorModelPools.map(({ connector, models }) => { const enabledCount = models.filter((model) => model.enabled).length; const allEnabled = models.length > 0 && enabledCount === models.length; // One action, state-aware: when everything is on the next useful // move is "disable all"; otherwise the user almost always wants // "enable all". Two buttons would compete for the user's decision // for no real benefit. const bulkAction = allEnabled ? { label: t("models.disableAll"), target: false } : { label: t("models.enableAll"), target: true }; return (
{/* Row 1 — identity + health. Title has room to breathe. */}
{connector.id.startsWith("claude_compat") && connector.notes ? connector.notes : connector.label} {connector.id === selectedConnectorId ? ( {t("models.ceoRuntime")} ) : null}
{/* Row 2 — stats + bulk action. Only rendered when there is */} {/* more than one model (single-model providers have nothing */} {/* meaningful to bulk-toggle). */}
{t("models.poolSummary").replace("{enabled}", String(enabledCount)).replace("{total}", String(models.length || 0))} {models.length > 1 ? ( ) : null}
void onToggleConnectorModel(connector.id, modelId)} canRemove={false} />
); })}
{error ? (
{error}
) : null}
{readinessHint}
); }