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
344e30be
Commit
344e30be
authored
Mar 07, 2024
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
node
parent
45ef4059
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
13 deletions
+33
-13
item.tsx
web/app/components/workflow/block-selector/tools/item.tsx
+3
-2
types.ts
web/app/components/workflow/block-selector/types.ts
+2
-1
constants.ts
web/app/components/workflow/constants.ts
+12
-0
index.tsx
web/app/components/workflow/index.tsx
+3
-1
index.tsx
.../workflow/nodes/_base/components/panel-operator/index.tsx
+10
-7
panel.tsx
web/app/components/workflow/nodes/_base/panel.tsx
+1
-2
types.ts
web/app/components/workflow/types.ts
+2
-0
No files found.
web/app/components/workflow/block-selector/tools/item.tsx
View file @
344e30be
...
@@ -105,9 +105,10 @@ const Item = ({
...
@@ -105,9 +105,10 @@ const Item = ({
provider_id
:
data
.
id
,
provider_id
:
data
.
id
,
provider_type
:
data
.
type
,
provider_type
:
data
.
type
,
tool_name
:
tool
.
name
,
tool_name
:
tool
.
name
,
_icon
:
data
.
icon
,
title
:
tool
.
label
[
language
],
title
:
tool
.
label
[
language
],
desc
:
tool
.
description
[
language
],
_icon
:
data
.
icon
,
_about
:
tool
.
description
[
language
],
_author
:
data
.
author
,
})
}
})
}
>
>
<
div
className=
'absolute left-[22px] w-[1px] h-8 bg-black/5'
/>
<
div
className=
'absolute left-[22px] w-[1px] h-8 bg-black/5'
/>
...
...
web/app/components/workflow/block-selector/types.ts
View file @
344e30be
...
@@ -30,6 +30,7 @@ export type ToolDefaultValue = {
...
@@ -30,6 +30,7 @@ export type ToolDefaultValue = {
provider_type
:
string
provider_type
:
string
tool_name
:
string
tool_name
:
string
title
:
string
title
:
string
desc
:
string
_icon
:
Collection
[
'icon'
]
_icon
:
Collection
[
'icon'
]
_about
:
string
_author
:
string
}
}
web/app/components/workflow/constants.ts
View file @
344e30be
...
@@ -14,24 +14,28 @@ import EndNodeDefault from './nodes/end/default'
...
@@ -14,24 +14,28 @@ import EndNodeDefault from './nodes/end/default'
export
const
NODES_INITIAL_DATA
=
{
export
const
NODES_INITIAL_DATA
=
{
[
BlockEnum
.
Start
]:
{
[
BlockEnum
.
Start
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
Start
,
type
:
BlockEnum
.
Start
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
StartNodeDefault
.
defaultValue
,
...
StartNodeDefault
.
defaultValue
,
},
},
[
BlockEnum
.
End
]:
{
[
BlockEnum
.
End
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
End
,
type
:
BlockEnum
.
End
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
EndNodeDefault
.
defaultValue
,
...
EndNodeDefault
.
defaultValue
,
},
},
[
BlockEnum
.
DirectAnswer
]:
{
[
BlockEnum
.
DirectAnswer
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
DirectAnswer
,
type
:
BlockEnum
.
DirectAnswer
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
DirectAnswerDefault
.
defaultValue
,
...
DirectAnswerDefault
.
defaultValue
,
},
},
[
BlockEnum
.
LLM
]:
{
[
BlockEnum
.
LLM
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
LLM
,
type
:
BlockEnum
.
LLM
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -39,6 +43,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -39,6 +43,7 @@ export const NODES_INITIAL_DATA = {
...
LLMDefault
.
defaultValue
,
...
LLMDefault
.
defaultValue
,
},
},
[
BlockEnum
.
KnowledgeRetrieval
]:
{
[
BlockEnum
.
KnowledgeRetrieval
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
KnowledgeRetrieval
,
type
:
BlockEnum
.
KnowledgeRetrieval
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -48,6 +53,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -48,6 +53,7 @@ export const NODES_INITIAL_DATA = {
...
KnowledgeRetrievalDefault
.
defaultValue
,
...
KnowledgeRetrievalDefault
.
defaultValue
,
},
},
[
BlockEnum
.
IfElse
]:
{
[
BlockEnum
.
IfElse
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
IfElse
,
type
:
BlockEnum
.
IfElse
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -55,6 +61,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -55,6 +61,7 @@ export const NODES_INITIAL_DATA = {
...
IfElseDefault
.
defaultValue
,
...
IfElseDefault
.
defaultValue
,
},
},
[
BlockEnum
.
Code
]:
{
[
BlockEnum
.
Code
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
Code
,
type
:
BlockEnum
.
Code
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -65,6 +72,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -65,6 +72,7 @@ export const NODES_INITIAL_DATA = {
...
CodeDefault
.
defaultValue
,
...
CodeDefault
.
defaultValue
,
},
},
[
BlockEnum
.
TemplateTransform
]:
{
[
BlockEnum
.
TemplateTransform
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
TemplateTransform
,
type
:
BlockEnum
.
TemplateTransform
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -73,6 +81,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -73,6 +81,7 @@ export const NODES_INITIAL_DATA = {
...
TemplateTransformDefault
.
defaultValue
,
...
TemplateTransformDefault
.
defaultValue
,
},
},
[
BlockEnum
.
QuestionClassifier
]:
{
[
BlockEnum
.
QuestionClassifier
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
QuestionClassifier
,
type
:
BlockEnum
.
QuestionClassifier
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -81,6 +90,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -81,6 +90,7 @@ export const NODES_INITIAL_DATA = {
...
QuestionClassifierDefault
.
defaultValue
,
...
QuestionClassifierDefault
.
defaultValue
,
},
},
[
BlockEnum
.
HttpRequest
]:
{
[
BlockEnum
.
HttpRequest
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
HttpRequest
,
type
:
BlockEnum
.
HttpRequest
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -88,6 +98,7 @@ export const NODES_INITIAL_DATA = {
...
@@ -88,6 +98,7 @@ export const NODES_INITIAL_DATA = {
...
HttpRequestDefault
.
defaultValue
,
...
HttpRequestDefault
.
defaultValue
,
},
},
[
BlockEnum
.
VariableAssigner
]:
{
[
BlockEnum
.
VariableAssigner
]:
{
_author
:
'Dify'
,
type
:
BlockEnum
.
VariableAssigner
,
type
:
BlockEnum
.
VariableAssigner
,
title
:
''
,
title
:
''
,
desc
:
''
,
desc
:
''
,
...
@@ -106,3 +117,4 @@ export const NODES_INITIAL_DATA = {
...
@@ -106,3 +117,4 @@ export const NODES_INITIAL_DATA = {
export
const
NODE_WIDTH
=
220
export
const
NODE_WIDTH
=
220
export
const
X_OFFSET
=
64
export
const
X_OFFSET
=
64
export
const
Y_OFFSET
=
39
export
const
Y_OFFSET
=
39
export
const
TREE_DEEPTH
=
20
web/app/components/workflow/index.tsx
View file @
344e30be
...
@@ -202,7 +202,9 @@ const WorkflowWrap: FC<WorkflowProps> = ({
...
@@ -202,7 +202,9 @@ const WorkflowWrap: FC<WorkflowProps> = ({
if
(
isLoading
)
{
if
(
isLoading
)
{
return
(
return
(
<
Loading
/>
<
div
className=
'flex justify-center items-center relative w-full h-full bg-[#F0F2F7]'
>
<
Loading
/>
</
div
>
)
)
}
}
...
...
web/app/components/workflow/nodes/_base/components/panel-operator/index.tsx
View file @
344e30be
...
@@ -11,18 +11,21 @@ import {
...
@@ -11,18 +11,21 @@ import {
PortalToFollowElemContent
,
PortalToFollowElemContent
,
PortalToFollowElemTrigger
,
PortalToFollowElemTrigger
,
}
from
'@/app/components/base/portal-to-follow-elem'
}
from
'@/app/components/base/portal-to-follow-elem'
import
type
{
Node
}
from
'@/app/components/workflow/types'
type
PanelOperatorProps
=
{
type
PanelOperatorProps
=
{
nodeId
:
string
id
:
string
data
:
Node
[
'data'
]
}
}
const
PanelOperator
=
({
const
PanelOperator
=
({
nodeId
,
id
,
data
,
}:
PanelOperatorProps
)
=>
{
}:
PanelOperatorProps
)
=>
{
const
edges
=
useEdges
()
const
edges
=
useEdges
()
const
{
handleNodeDelete
}
=
useWorkflow
()
const
{
handleNodeDelete
}
=
useWorkflow
()
const
[
open
,
setOpen
]
=
useState
(
false
)
const
[
open
,
setOpen
]
=
useState
(
false
)
const
edge
=
edges
.
find
(
edge
=>
edge
.
target
===
nodeI
d
)
const
edge
=
edges
.
find
(
edge
=>
edge
.
target
===
i
d
)
return
(
return
(
<
PortalToFollowElem
<
PortalToFollowElem
...
@@ -49,7 +52,7 @@ const PanelOperator = ({
...
@@ -49,7 +52,7 @@ const PanelOperator = ({
<
div
className=
'w-[240px] border-[0.5px] border-gray-200 rounded-2xl shadow-xl bg-white'
>
<
div
className=
'w-[240px] border-[0.5px] border-gray-200 rounded-2xl shadow-xl bg-white'
>
<
div
className=
'p-1'
>
<
div
className=
'p-1'
>
<
ChangeBlock
<
ChangeBlock
nodeId=
{
nodeI
d
}
nodeId=
{
i
d
}
sourceHandle=
{
edge
?.
sourceHandle
||
'source'
}
sourceHandle=
{
edge
?.
sourceHandle
||
'source'
}
/>
/>
<
div
className=
'flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50'
>
Help Link
</
div
>
<
div
className=
'flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50'
>
Help Link
</
div
>
...
@@ -58,7 +61,7 @@ const PanelOperator = ({
...
@@ -58,7 +61,7 @@ const PanelOperator = ({
<
div
className=
'p-1'
>
<
div
className=
'p-1'
>
<
div
<
div
className=
'flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50'
className=
'flex items-center px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50'
onClick=
{
()
=>
handleNodeDelete
(
nodeI
d
)
}
onClick=
{
()
=>
handleNodeDelete
(
i
d
)
}
>
>
Delete
Delete
</
div
>
</
div
>
...
@@ -69,10 +72,10 @@ const PanelOperator = ({
...
@@ -69,10 +72,10 @@ const PanelOperator = ({
<
div
className=
'flex items-center mb-1 h-[22px] font-medium'
>
<
div
className=
'flex items-center mb-1 h-[22px] font-medium'
>
ABOUT
ABOUT
</
div
>
</
div
>
<
div
className=
'text-gray-500 leading-[18px]'
>
A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query.
</
div
>
<
div
className=
'text-gray-500 leading-[18px]'
>
{
data
.
_about
}
</
div
>
<
div
className=
'my-2 h-[0.5px] bg-black/5'
></
div
>
<
div
className=
'my-2 h-[0.5px] bg-black/5'
></
div
>
<
div
className=
'leading-[18px]'
>
<
div
className=
'leading-[18px]'
>
Created By
Dify
Created By
{
data
.
_author
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/app/components/workflow/nodes/_base/panel.tsx
View file @
344e30be
...
@@ -34,7 +34,6 @@ const BasePanel: FC<BasePanelProps> = ({
...
@@ -34,7 +34,6 @@ const BasePanel: FC<BasePanelProps> = ({
data
,
data
,
children
,
children
,
})
=>
{
})
=>
{
const
type
=
data
.
type
const
{
const
{
handleNodeSelect
,
handleNodeSelect
,
handleNodeDataUpdate
,
handleNodeDataUpdate
,
...
@@ -75,7 +74,7 @@ const BasePanel: FC<BasePanelProps> = ({
...
@@ -75,7 +74,7 @@ const BasePanel: FC<BasePanelProps> = ({
</
TooltipPlus
>
</
TooltipPlus
>
)
)
}
}
<
PanelOperator
nodeId=
{
id
}
/>
<
PanelOperator
id=
{
id
}
data=
{
data
}
/>
<
div
className=
'mx-3 w-[1px] h-3.5 bg-gray-200'
/>
<
div
className=
'mx-3 w-[1px] h-3.5 bg-gray-200'
/>
<
div
<
div
className=
'flex items-center justify-center w-6 h-6 cursor-pointer'
className=
'flex items-center justify-center w-6 h-6 cursor-pointer'
...
...
web/app/components/workflow/types.ts
View file @
344e30be
...
@@ -31,6 +31,8 @@ export type CommonNodeType<T = {}> = {
...
@@ -31,6 +31,8 @@ export type CommonNodeType<T = {}> = {
_targetBranches
?:
Branch
[]
_targetBranches
?:
Branch
[]
_isSingleRun
?:
boolean
_isSingleRun
?:
boolean
_icon
?:
Collection
[
'icon'
]
_icon
?:
Collection
[
'icon'
]
_about
?:
string
_author
?:
string
title
:
string
title
:
string
desc
:
string
desc
:
string
type
:
BlockEnum
type
:
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