fix(onboarding): drop "Default" sentinel from model picker; auto-select real model

The CEO-runtime model dropdown on the Company onboarding step rendered
a {value:"", label:"默认 / Default"} sentinel as the first option, a
holdover from the adapter era when "" meant "let the connector pick".
Under pi-mono every connector carries a defaultModel and every run
must bind a concrete model id, so the sentinel is now misleading —
picking it left selectedModel empty and the wizard would advance
without a valid model.

- CompanyStep: drop the sentinel from the options array; the dropdown
  now shows only real models (or a single "Loading..." entry while
  the per-connector fetch is in flight).
- useConnectorModelSelection: when the connector's current model is
  not enabled, auto-select the connector's defaultModel if enabled,
  otherwise the first enabled model. An empty enabled list still
  falls back to "" so the CompanyStep hint UI behaves correctly.

Result: Fire Pass now shows "Kimi K2.5 Turbo (Fire Pass)" as the
sole option (pre-selected). Every other connector picks its catalog
default up-front.

typecheck 0 / lint 0-0 / build 0-0 / test:unit 508/508.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-17 09:54:46 -04:00
1 parent e7e43bd0a6
commit 9b45b12508
2 files changed
+22 -10

No files matched your search

@@ -71,10 +71,11 @@ export function CompanyStep({ onContinue, onBack }: CompanyStepProps) {
value={selectedModel} value={selectedModel}
onChange={setSelectedModel} onChange={setSelectedModel}
disabled={loadingModels || modelOptions.length === 0} disabled={loadingModels || modelOptions.length === 0}
options={[ options={
{ value: "", label: loadingModels ? (currentLocale === "zh" ? "加载中..." : "Loading...") : (currentLocale === "zh" ? "默认" : "Default") }, loadingModels
...modelOptions.map((m) => ({ value: m.id, label: m.label })), ? [{ value: "", label: currentLocale === "zh" ? "加载中..." : "Loading..." }]
]} : modelOptions.map((m) => ({ value: m.id, label: m.label }))
}
/> />
</div> </div>
<div className="mt-3 rounded-lg border border-border bg-background/60 px-3 py-2.5 text-[11px] leading-relaxed text-muted-foreground"> <div className="mt-3 rounded-lg border border-border bg-background/60 px-3 py-2.5 text-[11px] leading-relaxed text-muted-foreground">
@@ -128,12 +128,23 @@ export function useConnectorModelSelection(
setSelectedModel(""); setSelectedModel("");
return; return;
} }
setSelectedModel((currentModel) => const enabledModels = connectorModels.filter((entry) => entry.enabled);
currentModel && connectorModels.some((entry) => entry.enabled && entry.id === currentModel) if (enabledModels.length === 0) {
? currentModel setSelectedModel("");
: "", return;
); }
}, [connectorModels, selectedConnectorId]); setSelectedModel((currentModel) => {
if (currentModel && enabledModels.some((entry) => entry.id === currentModel)) {
return currentModel;
}
const connectorDefinition = executionReadyConnectors.find((c) => c.id === selectedConnectorId);
const preferred = connectorDefinition?.model;
if (preferred && enabledModels.some((entry) => entry.id === preferred)) {
return preferred;
}
return enabledModels[0]?.id ?? "";
});
}, [connectorModels, selectedConnectorId, executionReadyConnectors]);
const modelOptions = useMemo( const modelOptions = useMemo(
() => connectorModels () => connectorModels