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
4d4d3bb9
Commit
4d4d3bb9
authored
Feb 27, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add default values and utils and fix ts
parent
3d526b3a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
6 deletions
+31
-6
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+2
-2
constants.ts
web/app/components/workflow/nodes/constants.ts
+1
-1
node.tsx
web/app/components/workflow/nodes/if-else/node.tsx
+3
-3
default.ts
...pp/components/workflow/nodes/variable-assigner/default.ts
+14
-0
utils.ts
web/app/components/workflow/nodes/variable-assigner/utils.ts
+5
-0
types.ts
web/app/components/workflow/types.ts
+6
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
4d4d3bb9
...
...
@@ -5,9 +5,9 @@ import { memo } from 'react'
import
Workflow
from
'@/app/components/workflow'
import
{
BlockEnum
}
from
'@/app/components/workflow/types'
const
nodes
=
[
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
LLM
/* 3 */
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
LLM
/* 3 */
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
IfElse
/* 6 */
,
BlockEnum
.
Code
/* 7 */
,
BlockEnum
.
TemplateTransform
/* 8 */
,
BlockEnum
.
HttpRequest
/* 9 */
,
BlockEnum
.
Tool
/* 10 */
,
BlockEnum
.
End
/* 12 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
End
/* 12 */
,
].
map
((
item
,
i
)
=>
({
id
:
`
${
i
+
1
}
`
,
type
:
'custom'
,
...
...
web/app/components/workflow/nodes/constants.ts
View file @
4d4d3bb9
...
...
@@ -25,7 +25,7 @@ import ToolPanel from './tool/panel'
import
VariableAssignerNode
from
'./variable-assigner/node'
import
VariableAssignerPanel
from
'./variable-assigner/panel'
export
const
NodeComponentMap
:
Record
<
string
,
ComponentType
>
=
{
export
const
NodeComponentMap
:
Record
<
string
,
ComponentType
<
any
>
>
=
{
[
BlockEnum
.
Start
]:
StartNode
,
[
BlockEnum
.
End
]:
EndNode
,
[
BlockEnum
.
DirectAnswer
]:
DirectAnswerNode
,
...
...
web/app/components/workflow/nodes/if-else/node.tsx
View file @
4d4d3bb9
import
{
memo
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
type
{
NodeProps
}
from
'reactflow'
import
{
NodeSourceHandle
}
from
'../_base/components/node-handle'
...
...
@@ -14,7 +14,7 @@ const notTranslateKey = [
ComparisonOperator
.
lessThan
,
ComparisonOperator
.
lessThanOrEqual
,
]
const
Node
=
(
props
:
Pick
<
NodeProps
,
'id'
|
'data'
>
)
=>
{
const
IfElseNode
:
FC
<
Pick
<
NodeProps
,
'id'
|
'data'
>>
=
(
props
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
conditions
,
logical_operator
}
=
mockData
...
...
@@ -56,4 +56,4 @@ const Node = (props: Pick<NodeProps, 'id' | 'data'>) => {
)
}
export
default
memo
(
Node
)
export
default
IfElseNode
web/app/components/workflow/nodes/variable-assigner/default.ts
0 → 100644
View file @
4d4d3bb9
import
type
{
NodeDefault
}
from
'../../types'
import
type
{
VariableAssignerNodeType
}
from
'./types'
const
nodeDefault
:
NodeDefault
<
VariableAssignerNodeType
>
=
{
defaultValue
:
{},
getAvailablePrevNodes
()
{
return
[]
},
getAvailableNextNodes
()
{
return
[]
},
}
export
default
nodeDefault
web/app/components/workflow/nodes/variable-assigner/utils.ts
0 → 100644
View file @
4d4d3bb9
import
type
{
VariableAssignerNodeType
}
from
'./types'
export
const
checkNodeValid
=
(
node
:
VariableAssignerNodeType
)
=>
{
return
true
}
web/app/components/workflow/types.ts
View file @
4d4d3bb9
...
...
@@ -101,3 +101,9 @@ export type Block = {
title
:
string
description
?:
string
}
export
type
NodeDefault
<
T
>
=
{
defaultValue
:
Partial
<
T
>
getAvailablePrevNodes
:
()
=>
BlockEnum
[]
getAvailableNextNodes
:
()
=>
BlockEnum
[]
}
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