import { useState, useEffect } from 'react'; import { Input } from '@librechat/client'; import { useLocalize } from '~/hooks'; import { Info } from 'lucide-react'; const MAX_LENGTH = 120; const Description = ({ initialValue, onValueChange, disabled, tabIndex, }: { initialValue?: string; onValueChange?: (value: string) => void; disabled?: boolean; tabIndex?: number; }) => { const localize = useLocalize(); const [description, setDescription] = useState(initialValue || ''); const [charCount, setCharCount] = useState(initialValue?.length || 0); useEffect(() => { setDescription(initialValue || ''); setCharCount(initialValue?.length || 0); }, [initialValue]); useEffect(() => { setCharCount(description.length); }, [description]); const handleInputChange: React.ChangeEventHandler = (e) => { if (e.target.value.length <= MAX_LENGTH) { setDescription(e.target.value); onValueChange?.(e.target.value); } }; if (disabled && !description) { return null; } return (
); }; export default Description;