import classNames from 'classnames'; import { Handle, NodeProps, Position } from 'reactflow'; import OperateDropdown from '@/components/operate-dropdown'; import { CopyOutlined } from '@ant-design/icons'; import { Flex, MenuProps, Space, Typography } from 'antd'; import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Operator, operatorMap } from '../../constant'; import OperatorIcon from '../../operator-icon'; import useGraphStore from '../../store'; import styles from './index.less'; const { Text } = Typography; export function RagNode({ id, data, isConnectable = true, selected, }: NodeProps<{ label: string }>) { const { t } = useTranslation(); const deleteNodeById = useGraphStore((store) => store.deleteNodeById); const duplicateNodeById = useGraphStore((store) => store.duplicateNode); const deleteNode = useCallback(() => { deleteNodeById(id); }, [id, deleteNodeById]); const duplicateNode = useCallback(() => { duplicateNodeById(id); }, [id, duplicateNodeById]); const description = operatorMap[data.label as Operator].description; const items: MenuProps['items'] = [ { key: '2', onClick: duplicateNode, label: ( {t('common.copy')} ), }, ]; return (
{/* */} {/* */} {data.label}
{description}
); }