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
6057ba09
Commit
6057ba09
authored
Feb 22, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: var assigner node struct
parent
2fdcf175
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
8 deletions
+56
-8
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+3
-8
constants.ts
web/app/components/workflow/nodes/constants.ts
+4
-0
mock.ts
web/app/components/workflow/nodes/variable-assigner/mock.ts
+12
-0
node.tsx
web/app/components/workflow/nodes/variable-assigner/node.tsx
+16
-0
panel.tsx
...app/components/workflow/nodes/variable-assigner/panel.tsx
+9
-0
types.ts
web/app/components/workflow/nodes/variable-assigner/types.ts
+6
-0
workflow.en.ts
web/i18n/lang/workflow.en.ts
+3
-0
workflow.zh.ts
web/i18n/lang/workflow.zh.ts
+3
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
6057ba09
...
...
@@ -6,8 +6,8 @@ import Workflow from '@/app/components/workflow'
import
{
BlockEnum
}
from
'@/app/components/workflow/types'
const
nodes
=
[
BlockEnum
.
Start
,
BlockEnum
.
DirectAnswer
,
BlockEnum
.
LLM
,
BlockEnum
.
KnowledgeRetrieval
,
BlockEnum
.
QuestionClassifier
,
BlockEnum
.
IfElse
,
BlockEnum
.
Code
,
BlockEnum
.
TemplateTransform
,
BlockEnum
.
HttpRequest
,
BlockEnum
.
Tool
,
BlockEnum
.
End
,
BlockEnum
.
IfElse
,
BlockEnum
.
Code
,
BlockEnum
.
TemplateTransform
,
BlockEnum
.
HttpRequest
,
BlockEnum
.
Tool
,
BlockEnum
.
VariableAssigner
,
BlockEnum
.
End
,
].
map
((
item
,
i
)
=>
({
id
:
`
${
i
+
1
}
`
,
type
:
'custom'
,
...
...
@@ -43,12 +43,7 @@ const Page: FC = () => {
<
Workflow
nodes=
{
initialNodes
}
edges=
{
initialEdges
}
/*
* TODO: for debug.
* 2 directAnswer 3: llm 5: questionClassifier
* 6 if else 7 Code, 8 TemplateTransform 9 http
*/
selectedNodeId=
'6'
selectedNodeId=
'1'
/>
</
div
>
)
...
...
web/app/components/workflow/nodes/constants.ts
View file @
6057ba09
...
...
@@ -22,6 +22,8 @@ import HttpNode from './http/node'
import
HttpPanel
from
'./http/panel'
import
ToolNode
from
'./tool/node'
import
ToolPanel
from
'./tool/panel'
import
VariableAssignerNode
from
'./variable-assigner/node'
import
VariableAssignerPanel
from
'./variable-assigner/panel'
export
const
NodeComponentMap
:
Record
<
string
,
ComponentType
>
=
{
[
BlockEnum
.
Start
]:
StartNode
,
...
...
@@ -35,6 +37,7 @@ export const NodeComponentMap: Record<string, ComponentType> = {
[
BlockEnum
.
TemplateTransform
]:
TemplateTransformNode
,
[
BlockEnum
.
HttpRequest
]:
HttpNode
,
[
BlockEnum
.
Tool
]:
ToolNode
,
[
BlockEnum
.
VariableAssigner
]:
VariableAssignerNode
,
}
export
const
PanelComponentMap
:
Record
<
string
,
ComponentType
>
=
{
...
...
@@ -49,4 +52,5 @@ export const PanelComponentMap: Record<string, ComponentType> = {
[
BlockEnum
.
TemplateTransform
]:
TemplateTransformPanel
,
[
BlockEnum
.
HttpRequest
]:
HttpPanel
,
[
BlockEnum
.
Tool
]:
ToolPanel
,
[
BlockEnum
.
VariableAssigner
]:
VariableAssignerPanel
,
}
web/app/components/workflow/nodes/variable-assigner/mock.ts
0 → 100644
View file @
6057ba09
import
type
{
VariableAssignerNodeType
}
from
'./types'
export
const
mockData
:
VariableAssignerNodeType
=
{
title
:
'Test'
,
desc
:
'Test'
,
type
:
'Test'
,
output_type
:
'string'
,
variables
:
[
[
'aaa'
,
'name'
],
[
'bbb'
,
'b'
,
'c'
],
],
}
web/app/components/workflow/nodes/variable-assigner/node.tsx
0 → 100644
View file @
6057ba09
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
// import { mockData } from './mock'
const
i18nPrefix
=
'workflow.nodes.variableAssigner'
const
Node
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
// const { variables } = mockData
return
(
<
div
className=
'px-3'
>
<
div
className=
'leading-4 text-xs font-medium text-gray-500 uppercase'
>
{
t
(
`${i18nPrefix}.title`
)
}
</
div
>
</
div
>
)
}
export
default
Node
web/app/components/workflow/nodes/variable-assigner/panel.tsx
0 → 100644
View file @
6057ba09
import
type
{
FC
}
from
'react'
const
Panel
:
FC
=
()
=>
{
return
(
<
div
>
start panel inputs
</
div
>
)
}
export
default
Panel
web/app/components/workflow/nodes/variable-assigner/types.ts
0 → 100644
View file @
6057ba09
import
type
{
CommonNodeType
,
ValueSelector
}
from
'@/app/components/workflow/types'
export
type
VariableAssignerNodeType
=
CommonNodeType
&
{
output_type
:
string
variables
:
ValueSelector
[]
}
web/i18n/lang/workflow.en.ts
View file @
6057ba09
...
...
@@ -71,6 +71,9 @@ const translation = {
'not null'
:
'is not null'
,
},
},
variableAssigner
:
{
title
:
'Assign variables'
,
},
},
}
...
...
web/i18n/lang/workflow.zh.ts
View file @
6057ba09
...
...
@@ -71,6 +71,9 @@ const translation = {
'not null'
:
'不为空'
,
},
},
variableAssigner
:
{
title
:
'变量赋值'
,
},
},
}
...
...
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