Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
b13345ce
Commit
b13345ce
authored
Mar 13, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove useless and node filter
parent
f15dce9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
17 deletions
+2
-17
use-workflow.ts
web/app/components/workflow/hooks/use-workflow.ts
+2
-7
var-reference-picker.tsx
.../nodes/_base/components/variable/var-reference-picker.tsx
+0
-10
No files found.
web/app/components/workflow/hooks/use-workflow.ts
View file @
b13345ce
...
...
@@ -8,6 +8,7 @@ import {
import
{
getLayoutByDagre
}
from
'../utils'
import
type
{
Node
}
from
'../types'
import
{
BlockEnum
}
from
'../types'
import
{
SUPPORT_OUTPUT_VARS_NODE
}
from
'../constants'
import
{
useStore
as
useAppStore
}
from
'@/app/components/app/store'
export
const
useIsChatMode
=
()
=>
{
...
...
@@ -105,13 +106,7 @@ export const useWorkflow = () => {
const
length
=
list
.
length
if
(
length
&&
list
.
some
(
item
=>
item
.
data
.
type
===
BlockEnum
.
Start
))
{
return
list
.
reverse
().
filter
((
item
)
=>
{
if
(
item
.
data
.
type
===
BlockEnum
.
IfElse
)
return
false
if
(
item
.
data
.
type
===
BlockEnum
.
QuestionClassifier
)
return
false
return
true
return
SUPPORT_OUTPUT_VARS_NODE
.
includes
(
item
.
data
.
type
)
})
}
...
...
web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
View file @
b13345ce
...
...
@@ -25,13 +25,6 @@ type Props = {
onChange
:
(
value
:
ValueSelector
)
=>
void
}
// const toShowVarType = (type: string) => {
// if (['text-input', 'paragraph', 'select', 'url'].includes(type))
// return 'String'
// return type.charAt(0).toUpperCase() + type.substring(1)
// }
export
const
getNodeInfoById
=
(
nodes
:
any
,
id
:
string
)
=>
{
return
nodes
.
find
((
node
:
any
)
=>
node
.
id
===
id
)
}
...
...
@@ -45,15 +38,12 @@ const VarReferencePicker: FC<Props> = ({
onChange
,
})
=>
{
const
{
getTreeLeafNodes
,
getBeforeNodesInSameBranch
}
=
useWorkflow
()
// console.log(getBeforeNodesInSameBranch(nodeId), getTreeLeafNodes())
const
availableNodes
=
getBeforeNodesInSameBranch
(
nodeId
)
const
outputVars
=
toNodeOutputVars
(
availableNodes
)
// console.log(outputVars)
const
[
open
,
setOpen
]
=
useState
(
false
)
const
hasValue
=
value
.
length
>
0
const
outputVarNodeId
=
hasValue
?
value
[
0
]
:
''
const
outputVarNode
=
hasValue
?
getNodeInfoById
(
availableNodes
,
outputVarNodeId
)?.
data
:
null
// console.log(hasValue, value, outputVarNode)
const
varName
=
hasValue
?
value
[
value
.
length
-
1
]
:
''
const
getVarType
=
()
=>
{
...
...
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