4.8.14 test (#3164)
* perf: match base 64 image * perf: register plugins
This commit is contained in:
@@ -6,6 +6,7 @@ import { NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowContext } from '../../../../context';
|
||||
import { WorkflowNodeEdgeContext } from '../../../../context/workflowInitContext';
|
||||
import { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
|
||||
export const ConnectionSourceHandle = ({
|
||||
nodeId,
|
||||
@@ -141,15 +142,23 @@ export const ConnectionTargetHandle = React.memo(function ConnectionTargetHandle
|
||||
const { connectingEdge, nodeList } = useContextSelector(WorkflowContext, (ctx) => ctx);
|
||||
|
||||
const { LeftHandle, rightHandle, topHandle, bottomHandle } = useMemo(() => {
|
||||
const node = nodeList.find((node) => node.nodeId === nodeId);
|
||||
const connectingNode = nodeList.find((node) => node.nodeId === connectingEdge?.nodeId);
|
||||
let node: FlowNodeItemType | undefined = undefined,
|
||||
connectingNode: FlowNodeItemType | undefined = undefined;
|
||||
for (const item of nodeList) {
|
||||
if (item.nodeId === nodeId) {
|
||||
node = item;
|
||||
}
|
||||
if (item.nodeId === connectingEdge?.nodeId) {
|
||||
connectingNode = item;
|
||||
}
|
||||
if (node && (connectingNode || !connectingEdge?.nodeId)) break;
|
||||
}
|
||||
|
||||
const connectingNodeSourceNodeIdMap = new Map<string, number>();
|
||||
let forbidConnect = false;
|
||||
edges.forEach((edge) => {
|
||||
if (edge.target === connectingNode?.nodeId) {
|
||||
connectingNodeSourceNodeIdMap.set(edge.source, 1);
|
||||
} else if (edge.target === nodeId) {
|
||||
for (const edge of edges) {
|
||||
if (forbidConnect) break;
|
||||
|
||||
if (edge.target === nodeId) {
|
||||
// Node has be connected tool, it cannot be connect by other handle
|
||||
if (edge.targetHandle === NodeOutputKeyEnum.selectedTools) {
|
||||
forbidConnect = true;
|
||||
@@ -163,7 +172,7 @@ export const ConnectionTargetHandle = React.memo(function ConnectionTargetHandle
|
||||
forbidConnect = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const showHandle = (() => {
|
||||
if (forbidConnect) return false;
|
||||
@@ -178,9 +187,6 @@ export const ConnectionTargetHandle = React.memo(function ConnectionTargetHandle
|
||||
// Not the same parent node
|
||||
if (connectingNode && connectingNode?.parentNodeId !== node?.parentNodeId) return false;
|
||||
|
||||
// Unable to connect to the source node
|
||||
if (connectingNodeSourceNodeIdMap.has(nodeId)) return false;
|
||||
|
||||
return true;
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user