import { OptionTypes } from 'librechat-data-provider'; import type { DynamicSettingProps } from 'librechat-data-provider'; import type { ValueType } from '@rc-component/mini-decimal'; import { Label, HoverCard, InputNumber, HoverCardTrigger } from '~/components/ui'; import { useLocalize, useDebouncedInput, useParameterEffects } from '~/hooks'; import { cn, defaultTextProps, optionText } from '~/utils'; import { ESide } from '~/common'; import { useChatContext } from '~/Providers'; import OptionHover from './OptionHover'; function DynamicInputNumber({ label, settingKey, defaultValue, description, columnSpan, setOption, optionType, readonly = false, showDefault = true, labelCode, descriptionCode, placeholderCode, placeholder, conversation, range, className = '', inputClassName = '', }: DynamicSettingProps) { const localize = useLocalize(); const { preset } = useChatContext(); const [setInputValue, inputValue] = useDebouncedInput({ optionKey: optionType !== OptionTypes.Custom ? settingKey : undefined, initialValue: optionType !== OptionTypes.Custom ? (conversation?.[settingKey] as number) : (defaultValue as number), setter: () => ({}), setOption, }); useParameterEffects({ preset, settingKey, defaultValue: typeof defaultValue === 'undefined' ? '' : defaultValue, conversation, inputValue, setInputValue, }); return (
{description && ( )}
); } export default DynamicInputNumber;