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
db6074e0
Commit
db6074e0
authored
Feb 22, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tool node
parent
6057ba09
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
5 deletions
+81
-5
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+3
-3
mock.ts
web/app/components/workflow/nodes/tool/mock.ts
+26
-0
node.tsx
web/app/components/workflow/nodes/tool/node.tsx
+28
-1
panel.tsx
web/app/components/workflow/nodes/tool/panel.tsx
+1
-1
types.ts
web/app/components/workflow/nodes/tool/types.ts
+23
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
db6074e0
...
...
@@ -5,9 +5,9 @@ import { memo } from 'react'
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
.
VariableAssigner
,
BlockEnum
.
End
,
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
.
VariableAssigner
/* 11 */
,
BlockEnum
.
End
/* 12 */
,
].
map
((
item
,
i
)
=>
({
id
:
`
${
i
+
1
}
`
,
type
:
'custom'
,
...
...
web/app/components/workflow/nodes/tool/mock.ts
0 → 100644
View file @
db6074e0
import
type
{
ToolNodeType
}
from
'./types'
import
{
VarType
}
from
'./types'
export
const
mockData
:
ToolNodeType
=
{
title
:
'Test'
,
desc
:
'Test'
,
type
:
'Test'
,
provider_id
:
'test'
,
provider_type
:
'builtin'
,
provider_name
:
'test'
,
tool_name
:
'test'
,
tool_label
:
'test'
,
tool_inputs
:
[
{
variable
:
'size'
,
variable_type
:
VarType
.
selector
,
value_selector
:
[
'aaa'
,
'name'
],
},
{
variable
:
'quality'
,
variable_type
:
VarType
.
static
,
value
:
'HD'
,
},
],
tool_parameters
:
{},
}
web/app/components/workflow/nodes/tool/node.tsx
View file @
db6074e0
import
type
{
FC
}
from
'react'
import
{
mockData
}
from
'./mock'
import
{
VarType
}
from
'./types'
import
{
Variable02
}
from
'@/app/components/base/icons/src/vender/solid/development'
const
Node
:
FC
=
()
=>
{
const
{
tool_inputs
}
=
mockData
return
(
<
div
>
tool
</
div
>
<
div
className=
'px-3'
>
<
div
className=
'space-y-0.5'
>
{
tool_inputs
.
map
((
input
,
index
)
=>
(
<
div
key=
{
index
}
className=
'flex items-center h-6 justify-between bg-gray-100 rounded-md px-1 space-x-1 text-xs font-normal text-gray-700'
>
<
div
className=
'text-xs font-medium text-gray-500 uppercase'
>
{
input
.
variable
}
</
div
>
<
div
className=
'text-xs font-normal text-gray-700'
>
{
input
.
variable_type
===
VarType
.
selector
?
(
<
div
className=
'flex items-center text-primary-600 space-x-0.5'
>
<
Variable02
className=
'h-3.5 w-3.5'
/>
<
div
className=
'font-medium'
>
{
input
.
value_selector
?.
slice
(
0
,
-
1
)[
0
]
}
</
div
>
</
div
>
)
:
input
.
value
}
</
div
>
</
div
>
))
}
</
div
>
</
div
>
)
}
...
...
web/app/components/workflow/nodes/tool/panel.tsx
View file @
db6074e0
...
...
@@ -2,7 +2,7 @@ import type { FC } from 'react'
const
Panel
:
FC
=
()
=>
{
return
(
<
div
>
start panel inputs
</
div
>
<
div
>
Tool input
</
div
>
)
}
...
...
web/app/components/workflow/nodes/tool/types.ts
0 → 100644
View file @
db6074e0
import
type
{
CommonNodeType
}
from
'@/app/components/workflow/types'
export
enum
VarType
{
selector
=
'selector'
,
static
=
'static'
,
}
export
type
ToolVarInput
=
{
variable
:
string
variable_type
:
VarType
value
?:
string
value_selector
?:
string
[]
}
export
type
ToolNodeType
=
CommonNodeType
&
{
provider_id
:
string
provider_type
:
'builtin'
provider_name
:
string
tool_name
:
string
tool_label
:
string
tool_inputs
:
ToolVarInput
[]
tool_parameters
:
Record
<
string
,
any
>
}
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