mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-01 18:29:42 +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.Relevant,
|
||||
],
|
||||
[Operator.KeywordExtract]: [Operator.Begin],
|
||||
[Operator.Baidu]: [Operator.Begin],
|
||||
[Operator.DuckDuckGo]: [Operator.Begin],
|
||||
};
|
||||
|
||||
export const NodeMap = {
|
||||
|
||||
@ -297,12 +297,16 @@ export const useValidateConnection = () => {
|
||||
// restricted lines cannot be connected successfully.
|
||||
const isValidConnection = useCallback(
|
||||
(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
|
||||
const hasLine = edges.some(
|
||||
(x) => x.source === connection.source && x.target === connection.target,
|
||||
);
|
||||
|
||||
const ret =
|
||||
!isSelfConnected &&
|
||||
!hasLine &&
|
||||
RestrictedUpstreamMap[
|
||||
getOperatorTypeFromId(connection.source) as Operator
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user