Skip to content

Commit cb1de7b

Browse files
BelKedmaria-rcks
andauthored
fix(web): configure reasoning for the fallback model (#27593)
Co-authored-by: maria-rcks <[email protected]>
1 parent 854247e commit cb1de7b

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

0 commit comments

Comments
 (0)