import TextareaAutosize from 'react-textarea-autosize'; import { ImageDetail, imageDetailNumeric, imageDetailValue } from 'librechat-data-provider'; import type { ValueType } from '@rc-component/mini-decimal'; import type { TModelSelectProps } from '~/common'; import { Input, Label, Switch, Slider, HoverCard, InputNumber, HoverCardTrigger, } from '~/components/ui'; import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils/'; import { useLocalize, useDebouncedInput } from '~/hooks'; import OptionHover from './OptionHover'; import { ESide } from '~/common'; export default function Settings({ conversation, setOption, readonly, }: Omit) { /* This is an unfinished component for future update */ const localize = useLocalize(); const { endpoint, endpointType, chatGptLabel, promptPrefix, temperature, top_p: topP, frequency_penalty: freqP, presence_penalty: presP, resendFiles, imageDetail, } = conversation ?? {}; const [setChatGptLabel, chatGptLabelValue] = useDebouncedInput({ setOption, optionKey: 'chatGptLabel', initialValue: chatGptLabel, }); const [setPromptPrefix, promptPrefixValue] = useDebouncedInput({ setOption, optionKey: 'promptPrefix', initialValue: promptPrefix, }); const [setTemperature, temperatureValue] = useDebouncedInput({ setOption, optionKey: 'temperature', initialValue: temperature, }); const [setTopP, topPValue] = useDebouncedInput({ setOption, optionKey: 'top_p', initialValue: topP, }); const [setFreqP, freqPValue] = useDebouncedInput({ setOption, optionKey: 'frequency_penalty', initialValue: freqP, }); const [setPresP, presPValue] = useDebouncedInput({ setOption, optionKey: 'presence_penalty', initialValue: presP, }); if (!conversation) { return null; } const setResendFiles = setOption('resendFiles'); const setImageDetail = setOption('imageDetail'); const optionEndpoint = endpointType ?? endpoint; return (
void} max={2} min={0} step={0.01} controls={false} className={cn( defaultTextProps, cn( optionText, 'reset-rc-number-input reset-rc-number-input-text-right h-auto w-12 border-0 group-hover/temp:border-gray-200', ), )} />
setTemperature(value[0])} onDoubleClick={() => setTemperature(1)} max={2} min={0} step={0.01} className="flex h-4 w-full" />
setTopP(Number(value))} max={1} min={0} step={0.01} controls={false} className={cn( defaultTextProps, cn( optionText, 'reset-rc-number-input reset-rc-number-input-text-right h-auto w-12 border-0 group-hover/temp:border-gray-200', ), )} />
setTopP(value[0])} onDoubleClick={() => setTopP(1)} max={1} min={0} step={0.01} className="flex h-4 w-full" />
setFreqP(Number(value))} max={2} min={-2} step={0.01} controls={false} className={cn( defaultTextProps, cn( optionText, 'reset-rc-number-input reset-rc-number-input-text-right h-auto w-12 border-0 group-hover/temp:border-gray-200', ), )} />
setFreqP(value[0])} onDoubleClick={() => setFreqP(0)} max={2} min={-2} step={0.01} className="flex h-4 w-full" />
setPresP(Number(value))} max={2} min={-2} step={0.01} controls={false} className={cn( defaultTextProps, cn( optionText, 'reset-rc-number-input reset-rc-number-input-text-right h-auto w-12 border-0 group-hover/temp:border-gray-200', ), )} />
setPresP(value[0])} onDoubleClick={() => setPresP(0)} max={2} min={-2} step={0.01} className="flex h-4 w-full" />
setResendFiles(checked)} disabled={readonly} className="flex" /> setImageDetail(imageDetailValue[value[0]])} onDoubleClick={() => setImageDetail(ImageDetail.auto)} max={2} min={0} step={1} />
); }