diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index db26fa55a73..6ec2e631d19 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -95,6 +95,7 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { toastManager } from "../ui/toast"; import { BotIcon, + CheckIcon, CircleAlertIcon, ListTodoIcon, PencilRulerIcon, @@ -273,16 +274,25 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop {runtimeModeOptions.map((mode) => { const option = runtimeModeConfig[mode]; const OptionIcon = option.icon; + const isSelected = props.runtimeMode === mode; return ( - -
- - - {option.label} - - - {option.description} - + +
+
+ + + {option.label} + + + {option.description} + +
+
); diff --git a/apps/web/src/components/chat/TraitsPicker.tsx b/apps/web/src/components/chat/TraitsPicker.tsx index 91e14f20a91..714ee4239f3 100644 --- a/apps/web/src/components/chat/TraitsPicker.tsx +++ b/apps/web/src/components/chat/TraitsPicker.tsx @@ -16,7 +16,7 @@ import { } from "@t3tools/shared/model"; import { memo, useCallback, useState } from "react"; import type { VariantProps } from "class-variance-authority"; -import { ChevronDownIcon } from "lucide-react"; +import { CheckIcon, ChevronDownIcon } from "lucide-react"; import { Button, buttonVariants } from "../ui/button"; import { Menu, @@ -297,67 +297,90 @@ export const TraitsMenuContent = memo(function TraitsMenuContentImpl({ return ( <> - {selectDescriptors.map((descriptor, index) => ( -
- {index > 0 ? : null} - -
- {descriptor.label} -
- {ultrathinkInBodyText && descriptor.id === primarySelectDescriptor?.id ? ( -
- Your prompt contains "ultrathink" in the text. Remove it to change this - option. + {selectDescriptors.map((descriptor, index) => { + const selectedValue = + ultrathinkPromptControlled && descriptor.id === primarySelectDescriptor?.id + ? "ultrathink" + : (getDescriptorStringValue(descriptor) ?? ""); + + return ( +
+ {index > 0 ? : null} + +
+ {descriptor.label} +
+ {ultrathinkInBodyText && descriptor.id === primarySelectDescriptor?.id ? ( +
+ Your prompt contains "ultrathink" in the text. Remove it to change this + option. +
+ ) : null} + handleSelectChange(descriptor, value)} + > + {descriptor.options.map((option) => ( + + + + {option.label} + {option.isDefault ? ( + <> + {" "} + + + ) : null} + + {option.id === selectedValue ? ( + + ) : null} + + + ))} + +
+
+ ); + })} + {booleanDescriptors.map((descriptor, index) => { + const selectedValue = descriptor.currentValue === true ? "on" : "off"; + + return ( +
+ {index > 0 || selectDescriptors.length > 0 ? : null} + +
+ {descriptor.label}
- ) : null} - handleSelectChange(descriptor, value)} - > - {descriptor.options.map((option) => ( - - {option.label} - {option.isDefault ? ( - <> - {" "} - - - ) : null} - - ))} - -
-
- ))} - {booleanDescriptors.map((descriptor, index) => ( -
- {index > 0 || selectDescriptors.length > 0 ? : null} - -
- {descriptor.label} -
- { - updateDescriptors( - replaceDescriptorCurrentValue(descriptors, descriptor.id, value === "on"), - ); - }} - > - On - Off - -
-
- ))} + { + updateDescriptors( + replaceDescriptorCurrentValue(descriptors, descriptor.id, value === "on"), + ); + }} + > + {(["on", "off"] as const).map((value) => ( + + + {value === "on" ? "On" : "Off"} + {value === selectedValue ? ( + + ) : null} + + + ))} + + +
+ ); + })} ); }); diff --git a/apps/web/src/components/ui/menu.tsx b/apps/web/src/components/ui/menu.tsx index 07e27d23f46..e9ee42c8f65 100644 --- a/apps/web/src/components/ui/menu.tsx +++ b/apps/web/src/components/ui/menu.tsx @@ -147,32 +147,42 @@ function MenuRadioGroup(props: MenuPrimitive.RadioGroup.Props) { return ; } -function MenuRadioItem({ className, children, ...props }: MenuPrimitive.RadioItem.Props) { +function MenuRadioItem({ + className, + children, + hideIndicator = false, + ...props +}: MenuPrimitive.RadioItem.Props & { + hideIndicator?: boolean; +}) { return ( - - - - - - {children} + {hideIndicator ? null : ( + + + + + + )} + {children} ); }