mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Filter the query variable drop-down box options by type #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { IAgentNode } from '@/interfaces/database/flow';
|
||||
import { Handle, NodeProps, Position } from '@xyflow/react';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { NodeHandleId, Operator } from '../../constant';
|
||||
import { NodeHandleId } from '../../constant';
|
||||
import useGraphStore from '../../store';
|
||||
import { isBottomSubAgent } from '../../utils';
|
||||
import { CommonHandle } from './handle';
|
||||
import { LeftHandleStyle, RightHandleStyle } from './handle-icon';
|
||||
import styles from './index.less';
|
||||
@ -16,19 +17,16 @@ function InnerAgentNode({
|
||||
isConnectable = true,
|
||||
selected,
|
||||
}: NodeProps<IAgentNode>) {
|
||||
const getNode = useGraphStore((state) => state.getNode);
|
||||
const edges = useGraphStore((state) => state.edges);
|
||||
|
||||
const isNotParentAgent = useMemo(() => {
|
||||
const edge = edges.find((x) => x.target === id);
|
||||
const label = getNode(edge?.source)?.data.label;
|
||||
return label !== Operator.Agent;
|
||||
}, [edges, getNode, id]);
|
||||
const isHeadAgent = useMemo(() => {
|
||||
return !isBottomSubAgent(edges, id);
|
||||
}, [edges, id]);
|
||||
|
||||
return (
|
||||
<ToolBar selected={selected} id={id} label={data.label}>
|
||||
<NodeWrapper>
|
||||
{isNotParentAgent && (
|
||||
{isHeadAgent && (
|
||||
<>
|
||||
<CommonHandle
|
||||
type="target"
|
||||
|
||||
Reference in New Issue
Block a user