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:
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}
|
||||
onChange={setSelectedModel}
|
||||
disabled={loadingModels || modelOptions.length === 0}
|
||||
options={[
|
||||
{ value: "", label: loadingModels ? (currentLocale === "zh" ? "加载中..." : "Loading...") : (currentLocale === "zh" ? "默认" : "Default") },
|
||||
...modelOptions.map((m) => ({ value: m.id, label: m.label })),
|
||||
]}
|
||||
options={
|
||||
loadingModels
|
||||
? [{ value: "", label: currentLocale === "zh" ? "加载中..." : "Loading..." }]
|
||||
: modelOptions.map((m) => ({ value: m.id, label: m.label }))
|
||||
}
|
||||
/>
|
||||
</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">
|
||||
|
||||
@@ -128,12 +128,23 @@ export function useConnectorModelSelection(
|
||||
setSelectedModel("");
|
||||
return;
|
||||
}
|
||||
setSelectedModel((currentModel) =>
|
||||
currentModel && connectorModels.some((entry) => entry.enabled && entry.id === currentModel)
|
||||
? currentModel
|
||||
: "",
|
||||
);
|
||||
}, [connectorModels, selectedConnectorId]);
|
||||
const enabledModels = connectorModels.filter((entry) => entry.enabled);
|
||||
if (enabledModels.length === 0) {
|
||||
setSelectedModel("");
|
||||
return;
|
||||
}
|
||||
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(
|
||||
() => connectorModels
|
||||
|
||||
Reference in new issue
Block a user