mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-13 16:44:07 +00:00
### What problem does this PR solve? feat: node cannot connect to itself #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
1cff117dc9
commit
0f597b9817
@ -254,6 +254,9 @@ export const RestrictedUpstreamMap = {
|
|||||||
Operator.Categorize,
|
Operator.Categorize,
|
||||||
Operator.Relevant,
|
Operator.Relevant,
|
||||||
],
|
],
|
||||||
|
[Operator.KeywordExtract]: [Operator.Begin],
|
||||||
|
[Operator.Baidu]: [Operator.Begin],
|
||||||
|
[Operator.DuckDuckGo]: [Operator.Begin],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NodeMap = {
|
export const NodeMap = {
|
||||||
|
|||||||
@ -297,12 +297,16 @@ export const useValidateConnection = () => {
|
|||||||
// restricted lines cannot be connected successfully.
|
// restricted lines cannot be connected successfully.
|
||||||
const isValidConnection = useCallback(
|
const isValidConnection = useCallback(
|
||||||
(connection: Connection) => {
|
(connection: Connection) => {
|
||||||
|
// node cannot connect to itself
|
||||||
|
const isSelfConnected = connection.target === connection.source;
|
||||||
|
|
||||||
// limit the connection between two nodes to only one connection line in one direction
|
// limit the connection between two nodes to only one connection line in one direction
|
||||||
const hasLine = edges.some(
|
const hasLine = edges.some(
|
||||||
(x) => x.source === connection.source && x.target === connection.target,
|
(x) => x.source === connection.source && x.target === connection.target,
|
||||||
);
|
);
|
||||||
|
|
||||||
const ret =
|
const ret =
|
||||||
|
!isSelfConnected &&
|
||||||
!hasLine &&
|
!hasLine &&
|
||||||
RestrictedUpstreamMap[
|
RestrictedUpstreamMap[
|
||||||
getOperatorTypeFromId(connection.source) as Operator
|
getOperatorTypeFromId(connection.source) as Operator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user