diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index 22bd532f5b8..4513d8b1835 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -144,8 +144,6 @@ export function AssistantEditor({ "#6FFFFF", ]; - const [showSearchTool, setShowSearchTool] = useState(false); - const [showAdvancedOptions, setShowAdvancedOptions] = useState(false); // state to persist across formik reformatting @@ -787,14 +785,8 @@ export function AssistantEditor({ }`} > { - setShowSearchTool(checked); setFieldValue("num_chunks", null); toggleToolInValues(searchTool.id); }} @@ -828,7 +820,7 @@ export function AssistantEditor({ )} {ccPairs.length > 0 && searchTool && - showSearchTool && + values.enabled_tools_map[searchTool.id] && !(user?.role != "admin" && documentSets.length === 0) && (
@@ -979,6 +971,7 @@ export function AssistantEditor({ onCheckedChange={() => { toggleToolInValues(internetSearchTool.id); }} + name={`enabled_tools_map.${internetSearchTool.id}`} />
@@ -1072,6 +1065,7 @@ export function AssistantEditor({
{ diff --git a/web/src/components/Modal.tsx b/web/src/components/Modal.tsx index b4c298ff2cd..f76e10dc8f1 100644 --- a/web/src/components/Modal.tsx +++ b/web/src/components/Modal.tsx @@ -22,6 +22,7 @@ interface ModalProps { noScroll?: boolean; heightOverride?: string; removeBottomPadding?: boolean; + removePadding?: boolean; } export function Modal({ @@ -39,6 +40,7 @@ export function Modal({ noScroll, heightOverride, removeBottomPadding, + removePadding, }: ModalProps) { const modalRef = useRef(null); const [isMounted, setIsMounted] = useState(false); @@ -114,7 +116,9 @@ export function Modal({ {icon && icon({ size: 30 })}
- {!hideDividerForTitle && } + {!hideDividerForTitle && ( + + )} )}
diff --git a/web/src/components/ui/checkbox.tsx b/web/src/components/ui/checkbox.tsx index ddfb542a5e0..96103c0bfea 100644 --- a/web/src/components/ui/checkbox.tsx +++ b/web/src/components/ui/checkbox.tsx @@ -3,6 +3,7 @@ import * as React from "react"; import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; import { Check } from "lucide-react"; +import { useField, FieldInputProps } from "formik"; import { cn } from "@/lib/utils"; @@ -10,14 +11,24 @@ const Checkbox = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { size?: "sm" | "md" | "lg"; + name?: string; } ->(({ className, size = "md", type = "button", ...props }, ref) => { +>(({ className, size = "md", type = "button", name, ...props }, ref) => { const sizeClasses = { sm: "h-3 w-3", md: "h-4 w-4", lg: "h-5 w-5", }; + const [field] = name + ? useField({ name, type: "checkbox" }) + : [ + { + value: props.checked, + onChange: props.onCheckedChange, + } as FieldInputProps, + ]; + return ( { + field.onChange({ target: { name, checked } }); + props.onCheckedChange?.(checked); + }} > & { circleClassName?: string; size?: "sm" | "md" | "lg"; + name?: string; } ->(({ circleClassName, className, size = "md", ...props }, ref) => { +>(({ circleClassName, className, size = "md", name, ...props }, ref) => { const sizeClasses = { sm: "h-4 w-8", md: "h-5 w-10", @@ -30,6 +32,15 @@ const Switch = React.forwardRef< lg: "data-[state=checked]:translate-x-6", }; + const [field] = name + ? useField({ name, type: "checkbox" }) + : [ + { + value: props.checked, + onChange: props.onCheckedChange, + } as FieldInputProps, + ]; + return ( { + field.onChange({ target: { name, checked } }); + props.onCheckedChange?.(checked); + }} ref={ref} >