Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
fc6f28f2
authored
Oct 01, 2024
by
Archer
Committed by
GitHub
Oct 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: variables check (#2849)
* fix: variables check * remove log
parent
d4b99ddc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
packages/global/core/workflow/utils.ts
+2
-1
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/hooks/useWorkflow.tsx
+6
-7
No files found.
packages/global/core/workflow/utils.ts
View file @
fc6f28f2
...
...
@@ -298,7 +298,8 @@ export const formatEditorVariablePickerIcon = (
};
export
const
isReferenceValue
=
(
value
:
any
,
nodeIds
:
string
[]):
boolean
=>
{
return
Array
.
isArray
(
value
)
&&
value
.
length
===
2
&&
nodeIds
.
includes
(
value
[
0
]);
const
validIdList
=
[
VARIABLE_NODE_ID
,
...
nodeIds
];
return
Array
.
isArray
(
value
)
&&
value
.
length
===
2
&&
validIdList
.
includes
(
value
[
0
]);
};
export
const
getElseIFLabel
=
(
i
:
number
)
=>
{
...
...
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/hooks/useWorkflow.tsx
View file @
fc6f28f2
...
...
@@ -423,8 +423,8 @@ export const useWorkflow = () => {
}
// If the node has child nodes, remove the child nodes
if
(
nodes
.
some
((
n
)
=>
n
.
data
.
parentNodeId
===
node
.
id
))
{
const
childNodes
=
nodes
.
filter
((
n
)
=>
n
.
data
.
parentNodeId
===
node
.
id
);
const
childNodes
=
nodes
.
filter
((
n
)
=>
n
.
data
.
parentNodeId
===
node
.
id
);
if
(
childNodes
.
length
>
0
)
{
const
childNodeIds
=
childNodes
.
map
((
n
)
=>
n
.
id
);
const
childNodesChange
=
childNodes
.
map
((
node
)
=>
({
...
change
,
...
...
@@ -440,14 +440,14 @@ export const useWorkflow = () => {
!
childNodeIds
.
includes
(
edge
.
target
)
)
);
return
;
}
setEdges
((
state
)
=>
state
.
filter
((
edge
)
=>
edge
.
source
!==
change
.
id
&&
edge
.
target
!==
change
.
id
)
);
onNodesChange
([
change
]);
return
true
;
return
;
});
const
handleSelectNode
=
useMemoizedFn
((
change
:
NodeSelectionChange
)
=>
{
// If the node is not selected and the Ctrl key is pressed, select the node
...
...
@@ -517,9 +517,8 @@ export const useWorkflow = () => {
if
(
change
.
type
===
'remove'
)
{
const
node
=
nodes
.
find
((
n
)
=>
n
.
id
===
change
.
id
);
// 如果删除失败,则不继续执行
if
(
node
&&
!
handleRemoveNode
(
change
,
node
))
{
return
;
}
node
&&
handleRemoveNode
(
change
,
node
);
return
;
}
else
if
(
change
.
type
===
'select'
)
{
handleSelectNode
(
change
);
}
else
if
(
change
.
type
===
'position'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment