import React, { useMemo } from 'react'; import * as DialogPrimitive from '@radix-ui/react-dialog'; import type { TPromptGroup } from 'librechat-data-provider'; import { OGDialog, OGDialogTitle, OGDialogContent } from '@librechat/client'; import { detectVariables } from '~/utils'; import VariableForm from './VariableForm'; interface VariableDialogProps extends Omit { onClose: () => void; group: TPromptGroup | null; } const VariableDialog: React.FC = ({ open, onClose, group }) => { const handleOpenChange = (open: boolean) => { if (!open) { onClose(); } }; const hasVariables = useMemo( () => detectVariables(group?.productionPrompt?.prompt ?? ''), [group?.productionPrompt?.prompt], ); if (!group) { return null; } if (!hasVariables) { return null; } return ( {group.name} ); }; export default VariableDialog;