import { OptionTypes } from 'librechat-data-provider'; import type { DynamicSettingProps } from 'librechat-data-provider'; import { Label, TextareaAutosize, HoverCard, HoverCardTrigger } from '~/components/ui'; import { useLocalize, useDebouncedInput, useParameterEffects, TranslationKeys } from '~/hooks'; import { cn } from '~/utils'; import { useChatContext } from '~/Providers'; import OptionHover from './OptionHover'; import { ESide } from '~/common'; function DynamicTextarea({ label = '', settingKey, defaultValue, description = '', columnSpan, setOption, optionType, placeholder = '', readonly = false, showDefault = false, labelCode = false, descriptionCode = false, placeholderCode = false, conversation, }: DynamicSettingProps) { const localize = useLocalize(); const { preset } = useChatContext(); const [setInputValue, inputValue, setLocalValue] = useDebouncedInput({ optionKey: settingKey, initialValue: optionType !== OptionTypes.Custom ? (conversation?.[settingKey] as string) : (defaultValue as string), setter: () => ({}), setOption, }); useParameterEffects({ preset, settingKey, defaultValue: typeof defaultValue === 'undefined' ? '' : defaultValue, conversation, inputValue, setInputValue: setLocalValue, }); return (
{description && ( )}
); } export default DynamicTextarea;