mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: add delete menu to graph node #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,19 +1,28 @@
|
||||
import classNames from 'classnames';
|
||||
import { Handle, NodeProps, Position } from 'reactflow';
|
||||
|
||||
import { Space } from 'antd';
|
||||
import { Operator } from '../../constant';
|
||||
import OperateDropdown from '@/components/operate-dropdown';
|
||||
import { Flex, Space } from 'antd';
|
||||
import { useCallback } from 'react';
|
||||
import { Operator, operatorMap } from '../../constant';
|
||||
import OperatorIcon from '../../operator-icon';
|
||||
import useGraphStore from '../../store';
|
||||
import styles from './index.less';
|
||||
|
||||
export function TextUpdaterNode({
|
||||
export function RagNode({
|
||||
id,
|
||||
data,
|
||||
isConnectable = true,
|
||||
selected,
|
||||
}: NodeProps<{ label: string }>) {
|
||||
const deleteNodeById = useGraphStore((store) => store.deleteNodeById);
|
||||
const deleteNode = useCallback(() => {
|
||||
deleteNodeById(id);
|
||||
}, [id, deleteNodeById]);
|
||||
|
||||
return (
|
||||
<section
|
||||
className={classNames(styles.textUpdaterNode, {
|
||||
className={classNames(styles.ragNode, {
|
||||
[styles.selectedNode]: selected,
|
||||
})}
|
||||
>
|
||||
@ -37,14 +46,21 @@ export function TextUpdaterNode({
|
||||
{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}
|
||||
</Handle>
|
||||
<Handle type="source" position={Position.Bottom} id="a" isConnectable />
|
||||
<div>
|
||||
<Space size={4}>
|
||||
<Flex gap={10} justify={'space-between'}>
|
||||
<Space size={6}>
|
||||
<OperatorIcon
|
||||
name={data.label as Operator}
|
||||
fontSize={12}
|
||||
></OperatorIcon>
|
||||
{data.label}
|
||||
<span>{data.label}</span>
|
||||
</Space>
|
||||
<OperateDropdown
|
||||
iconFontSize={14}
|
||||
deleteItem={deleteNode}
|
||||
></OperateDropdown>
|
||||
</Flex>
|
||||
<div className={styles.description}>
|
||||
{operatorMap[data.label as Operator].description}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user