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
2094a554
Commit
2094a554
authored
Feb 28, 2024
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple edge
parent
4837ae49
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
10 deletions
+29
-10
page.tsx
web/app/(commonLayout)/workflow/page.tsx
+2
-2
hooks.ts
web/app/components/workflow/hooks.ts
+1
-0
index.tsx
web/app/components/workflow/nodes/index.tsx
+1
-1
node.tsx
...pp/components/workflow/nodes/question-classifier/node.tsx
+16
-5
node.tsx
web/app/components/workflow/nodes/variable-assigner/node.tsx
+9
-2
No files found.
web/app/(commonLayout)/workflow/page.tsx
View file @
2094a554
...
@@ -33,13 +33,13 @@ const initialNodes = [
...
@@ -33,13 +33,13 @@ const initialNodes = [
id
:
'3'
,
id
:
'3'
,
type
:
'custom'
,
type
:
'custom'
,
position
:
{
x
:
738
,
y
:
130
},
position
:
{
x
:
738
,
y
:
130
},
data
:
{
type
:
'
llm
'
,
sortIndexInBranches
:
0
},
data
:
{
type
:
'
question-classifier
'
,
sortIndexInBranches
:
0
},
},
},
{
{
id
:
'4'
,
id
:
'4'
,
type
:
'custom'
,
type
:
'custom'
,
position
:
{
x
:
738
,
y
:
330
},
position
:
{
x
:
738
,
y
:
330
},
data
:
{
type
:
'
llm
'
,
sortIndexInBranches
:
1
},
data
:
{
type
:
'
variable-assigner
'
,
sortIndexInBranches
:
1
},
},
},
// {
// {
// id: '5',
// id: '5',
...
...
web/app/components/workflow/hooks.ts
View file @
2094a554
...
@@ -106,6 +106,7 @@ export const useWorkflow = () => {
...
@@ -106,6 +106,7 @@ export const useWorkflow = () => {
filtered
.
push
({
filtered
.
push
({
id
:
`
${
source
}
-
${
target
}
`
,
id
:
`
${
source
}
-
${
target
}
`
,
type
:
'custom'
,
source
:
source
!
,
source
:
source
!
,
target
:
target
!
,
target
:
target
!
,
sourceHandle
,
sourceHandle
,
...
...
web/app/components/workflow/nodes/index.tsx
View file @
2094a554
...
@@ -32,7 +32,7 @@ const CustomNode = memo((props: NodeProps) => {
...
@@ -32,7 +32,7 @@ const CustomNode = memo((props: NodeProps) => {
<
NodeComponent
/>
<
NodeComponent
/>
</
BaseNode
>
</
BaseNode
>
{
{
nodeData
.
type
!==
BlockEnum
.
IfElse
&&
(
nodeData
.
type
!==
BlockEnum
.
IfElse
&&
nodeData
.
type
!==
BlockEnum
.
QuestionClassifier
&&
(
<
NodeSourceHandle
<
NodeSourceHandle
{
...
props
}
{
...
props
}
handleClassName=
'!top-[17px] !-right-2'
handleClassName=
'!top-[17px] !-right-2'
...
...
web/app/components/workflow/nodes/question-classifier/node.tsx
View file @
2094a554
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
useState
}
from
'react'
import
{
useState
}
from
'react'
import
type
{
NodeProps
}
from
'reactflow'
import
InfoPanel
from
'../_base/components/info-panel'
import
InfoPanel
from
'../_base/components/info-panel'
import
{
NodeSourceHandle
}
from
'../_base/components/node-handle'
import
{
mockData
}
from
'./mock'
import
{
mockData
}
from
'./mock'
import
{
import
{
useTextGenerationCurrentProviderAndModelAndModelList
,
useTextGenerationCurrentProviderAndModelAndModelList
,
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
import
ModelSelector
from
'@/app/components/header/account-setting/model-provider-page/model-selector'
import
ModelSelector
from
'@/app/components/header/account-setting/model-provider-page/model-selector'
const
Node
:
FC
=
(
)
=>
{
const
Node
:
FC
<
Pick
<
NodeProps
,
'id'
|
'data'
>>
=
(
props
)
=>
{
const
{
provider
,
name
:
modelId
}
=
mockData
.
model
const
{
provider
,
name
:
modelId
}
=
mockData
.
model
const
tempTopics
=
mockData
.
topics
const
tempTopics
=
mockData
.
topics
const
[
topics
,
setTopics
]
=
useState
(
tempTopics
)
const
[
topics
,
setTopics
]
=
useState
(
tempTopics
)
...
@@ -23,11 +25,20 @@ const Node: FC = () => {
...
@@ -23,11 +25,20 @@ const Node: FC = () => {
/>
/>
<
div
className=
'mt-2 space-y-0.5'
>
<
div
className=
'mt-2 space-y-0.5'
>
{
topics
.
map
(
topic
=>
(
{
topics
.
map
(
topic
=>
(
<
InfoPanel
<
div
key=
{
topic
.
id
}
key=
{
topic
.
id
}
title=
{
topic
.
name
}
className=
'relative'
content=
{
topic
.
topic
}
>
/>
<
InfoPanel
title=
{
topic
.
name
}
content=
{
topic
.
topic
}
/>
<
NodeSourceHandle
{
...
props
}
handleId=
{
topic
.
name
}
handleClassName=
'!top-[11px] !-right-[21px]'
/>
</
div
>
))
}
))
}
{
/* For test */
}
{
/* For test */
}
<
div
<
div
...
...
web/app/components/workflow/nodes/variable-assigner/node.tsx
View file @
2094a554
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
useState
}
from
'react'
import
{
useState
}
from
'react'
import
type
{
NodeProps
}
from
'reactflow'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
NodeTargetHandle
}
from
'../_base/components/node-handle'
import
{
mockData
}
from
'./mock'
import
{
mockData
}
from
'./mock'
import
{
getNodeInfoById
}
from
'@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
import
{
getNodeInfoById
}
from
'@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
import
{
VarBlockIcon
}
from
'@/app/components/workflow/block-icon'
import
{
VarBlockIcon
}
from
'@/app/components/workflow/block-icon'
...
@@ -8,7 +10,7 @@ import { Line3 } from '@/app/components/base/icons/src/public/common'
...
@@ -8,7 +10,7 @@ import { Line3 } from '@/app/components/base/icons/src/public/common'
import
{
Variable02
}
from
'@/app/components/base/icons/src/vender/solid/development'
import
{
Variable02
}
from
'@/app/components/base/icons/src/vender/solid/development'
const
i18nPrefix
=
'workflow.nodes.variableAssigner'
const
i18nPrefix
=
'workflow.nodes.variableAssigner'
const
Node
:
FC
=
(
)
=>
{
const
Node
:
FC
<
Pick
<
NodeProps
,
'id'
|
'data'
>>
=
(
props
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
variables
:
tempVar
,
output_type
}
=
mockData
const
{
variables
:
tempVar
,
output_type
}
=
mockData
const
[
variables
,
setVariables
]
=
useState
(
tempVar
)
const
[
variables
,
setVariables
]
=
useState
(
tempVar
)
...
@@ -35,7 +37,12 @@ const Node: FC = () => {
...
@@ -35,7 +37,12 @@ const Node: FC = () => {
const
node
=
getNodeInfoById
(
item
[
0
])
const
node
=
getNodeInfoById
(
item
[
0
])
const
varName
=
item
[
item
.
length
-
1
]
const
varName
=
item
[
item
.
length
-
1
]
return
(
return
(
<
div
key=
{
index
}
className=
'flex items-center h-6 bg-gray-100 rounded-md px-1 text-xs font-normal text-gray-700'
>
<
div
key=
{
index
}
className=
'relative flex items-center h-6 bg-gray-100 rounded-md px-1 text-xs font-normal text-gray-700'
>
<
NodeTargetHandle
{
...
props
}
handleId=
{
varName
}
handleClassName=
'!top-1 !-left-[21px]'
/>
<
div
className=
'flex items-center'
>
<
div
className=
'flex items-center'
>
<
div
className=
'p-[1px]'
>
<
div
className=
'p-[1px]'
>
<
VarBlockIcon
<
VarBlockIcon
...
...
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