Skip to content

Commit 1319d55

Browse files
committed
fix(web): configure reasoning for the fallback model
1 parent 32ecd71 commit 1319d55

1 file changed

Lines changed: 51 additions & 28 deletions

File tree

‎apps/web/src/components/settings/ProjectDefaultsSettings.tsx‎

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
7979
const mixedModel = useScopedSettingsMixed(["defaultModelSelection"]);
8080
const mixedFallback = useScopedSettingsMixed(["fallbackModelSelection"]);
8181
const fallbackSelection = settings.fallbackModelSelection ?? selection;
82+
const fallbackEntry = entries.find((entry) => entry.instanceId === fallbackSelection?.instanceId);
8283
const fallbackModelOptions = getCustomModelOptionsByInstance(
8384
settings,
8485
providers,
@@ -242,34 +243,56 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
242243
}
243244
control={
244245
fallbackSelection ? (
245-
<ProviderModelPicker
246-
environmentId={representative?.environmentId ?? null}
247-
activeInstanceId={fallbackSelection.instanceId}
248-
model={fallbackSelection.model}
249-
lockedProvider={null}
250-
instanceEntries={entries}
251-
modelOptionsByInstance={fallbackModelOptions}
252-
triggerClassName={SETTINGS_PICKER_TRIGGER_CLASSNAME}
253-
triggerAriaLabel="Fallback model"
254-
{...(mixedFallback
255-
? { triggerLabel: "Mixed" }
256-
: settings.fallbackModelSelection === null
257-
? { triggerLabel: "None" }
258-
: {})}
259-
getModelDisabledReason={modelDisabledReason}
260-
onInstanceModelChange={(instanceId, model) => {
261-
const reason = modelDisabledReason(instanceId, model);
262-
if (reason) {
263-
toastManager.add({
264-
type: "error",
265-
title: "Fallback model not saved",
266-
description: reason,
267-
});
268-
return;
269-
}
270-
updateSettings({ fallbackModelSelection: createModelSelection(instanceId, model) });
271-
}}
272-
/>
246+
<div className="flex min-w-0 flex-wrap items-center justify-end gap-1.5">
247+
<ProviderModelPicker
248+
environmentId={representative?.environmentId ?? null}
249+
activeInstanceId={fallbackSelection.instanceId}
250+
model={fallbackSelection.model}
251+
lockedProvider={null}
252+
instanceEntries={entries}
253+
modelOptionsByInstance={fallbackModelOptions}
254+
triggerClassName={SETTINGS_PICKER_TRIGGER_CLASSNAME}
255+
triggerAriaLabel="Fallback model"
256+
{...(mixedFallback
257+
? { triggerLabel: "Mixed" }
258+
: settings.fallbackModelSelection === null
259+
? { triggerLabel: "None" }
260+
: {})}
261+
getModelDisabledReason={modelDisabledReason}
262+
onInstanceModelChange={(instanceId, model) => {
263+
const reason = modelDisabledReason(instanceId, model);
264+
if (reason) {
265+
toastManager.add({
266+
type: "error",
267+
title: "Fallback model not saved",
268+
description: reason,
269+
});
270+
return;
271+
}
272+
updateSettings({ fallbackModelSelection: createModelSelection(instanceId, model) });
273+
}}
274+
/>
275+
{settings.fallbackModelSelection !== null && fallbackEntry && !mixedFallback ? (
276+
<TraitsPicker
277+
provider={fallbackEntry.driverKind}
278+
models={fallbackEntry.models}
279+
model={fallbackSelection.model}
280+
modelOptions={fallbackSelection.options ?? []}
281+
allowPromptInjectedEffort={false}
282+
planModeEnabled={settings.planModeEnabled}
283+
triggerClassName={SETTINGS_PICKER_TRIGGER_CLASSNAME}
284+
onModelOptionsChange={(options) =>
285+
updateSettings({
286+
fallbackModelSelection: createModelSelection(
287+
fallbackSelection.instanceId,
288+
fallbackSelection.model,
289+
options,
290+
),
291+
})
292+
}
293+
/>
294+
) : null}
295+
</div>
273296
) : (
274297
<span className="text-sm text-muted-foreground">No providers available</span>
275298
)

0 commit comments

Comments
 (0)