- {index > 0 || selectDescriptors.length > 0 ?
: null}
+ {index > 0 || visibleSelectDescriptors.length > 0 ?
: null}
- {descriptor.label}
+ {getBooleanDescriptorLabel(descriptor)}
- {
- updateDescriptors(
- replaceDescriptorCurrentValue(descriptors, descriptor.id, value === "on"),
- );
- }}
- >
- On
- Off
-
+ {(() => {
+ const selectedValue = descriptor.currentValue === true ? "on" : "off";
+ return (
+ {
+ updateDescriptors(
+ replaceDescriptorCurrentValue(descriptors, descriptor.id, value === "on"),
+ );
+ onRequestClose?.();
+ }}
+ >
+ {(["on", "off"] as const).map((value) => (
+
+
+
+
+ {getBooleanDescriptorOptionLabel(descriptor, value)}
+ {value === selectedValue ? : null}
+
+ {descriptor.id === "fastMode" ? (
+
+ {getSpeedOptionDescription({ provider, model, value })}
+
+ ) : null}
+
+
+ ))}
+
+ );
+ })()}
))}
@@ -354,11 +463,12 @@ export const TraitsPicker = memo(function TraitsPicker({
onPromptChange,
modelOptions,
allowPromptInjectedEffort = true,
+ hiddenDescriptorIds,
+ showTriggerSeparators = true,
triggerVariant,
triggerClassName,
...persistence
}: TraitsMenuContentProps & TraitsPersistence) {
- const [isMenuOpen, setIsMenuOpen] = useState(false);
const { descriptors, primarySelectDescriptor, ultrathinkPromptControlled } =
getTraitsSectionVisibility({
provider,
@@ -368,6 +478,33 @@ export const TraitsPicker = memo(function TraitsPicker({
modelOptions,
allowPromptInjectedEffort,
});
+ const hiddenDescriptorIdSet = new Set(hiddenDescriptorIds ?? []);
+ const visibleDescriptors = descriptors.filter(
+ (descriptor) => !hiddenDescriptorIdSet.has(descriptor.id),
+ );
+ const isCodexStyle = provider === "codex";
+ const [openDescriptorId, setOpenDescriptorId] = useState