Feat: Filter the query variable drop-down box options by type #3221 (#8485)

### 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:
balibabu
2025-06-25 16:23:20 +08:00
committed by GitHub
parent b705ff08fe
commit c4b58ed195
13 changed files with 124 additions and 23 deletions

View File

@ -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"