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
801160c4
Commit
801160c4
authored
Mar 13, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tool output vars
parent
cb2a8142
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
0 deletions
+79
-0
constants.ts
web/app/components/workflow/constants.ts
+11
-0
utils.ts
...ponents/workflow/nodes/_base/components/variable/utils.ts
+7
-0
panel.tsx
web/app/components/workflow/nodes/tool/panel.tsx
+40
-0
types.ts
web/app/components/workflow/types.ts
+1
-0
workflow.ts
web/i18n/en-US/workflow.ts
+10
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+10
-0
No files found.
web/app/components/workflow/constants.ts
View file @
801160c4
...
...
@@ -312,3 +312,14 @@ export const HTTP_REQUEST_OUTPUT_STRUCT: Var[] = [
type
:
VarType
.
string
,
},
]
export
const
TOOL_OUTPUT_STRUCT
:
Var
[]
=
[
{
variable
:
'text'
,
type
:
VarType
.
string
,
},
{
variable
:
'files'
,
type
:
VarType
.
arrayFile
,
},
]
web/app/components/workflow/nodes/_base/components/variable/utils.ts
View file @
801160c4
...
...
@@ -11,6 +11,7 @@ import {
LLM_OUTPUT_STRUCT
,
SUPPORT_OUTPUT_VARS_NODE
,
TEMPLATE_TRANSFORM_OUTPUT_STRUCT
,
TOOL_OUTPUT_STRUCT
,
}
from
'@/app/components/workflow/constants'
const
inputVarTypeToVarType
=
(
type
:
InputVarType
):
VarType
=>
{
...
...
@@ -89,6 +90,12 @@ const formatItem = (item: any, isChatMode: boolean): NodeOutPutVar => {
type
:
output_type
,
},
]
break
}
case
BlockEnum
.
Tool
:
{
res
.
vars
=
TOOL_OUTPUT_STRUCT
break
}
}
...
...
web/app/components/workflow/nodes/tool/panel.tsx
View file @
801160c4
...
...
@@ -12,6 +12,7 @@ import Form from '@/app/components/header/account-setting/model-provider-page/mo
import
ConfigCredential
from
'@/app/components/tools/setting/build-in/config-credentials'
import
Loading
from
'@/app/components/base/loading'
import
BeforeRunForm
from
'@/app/components/workflow/nodes/_base/components/before-run-form'
import
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
const
i18nPrefix
=
'workflow.nodes.tool'
...
...
@@ -110,6 +111,45 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
/>
)
}
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
>
<>
<
VarItem
name=
'text'
type=
'Array[Object]'
description=
{
t
(
`${i18nPrefix}.outputVars.text`
)
}
/>
<
VarItem
name=
'files'
type=
'Array[File]'
description=
{
t
(
`${i18nPrefix}.outputVars.files.title`
)
}
subItems=
{
[
{
name
:
'type'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.files.type`
),
},
{
name
:
'transfer_method'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.files.transfer_method`
),
},
{
name
:
'url'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.files.url`
),
},
{
name
:
'upload_file_id'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.files.upload_file_id`
),
},
]
}
/>
</>
</
OutputVars
>
</
div
>
{
isShowSingleRun
&&
(
<
BeforeRunForm
nodeName=
{
inputs
.
title
}
...
...
web/app/components/workflow/types.ts
View file @
801160c4
...
...
@@ -128,6 +128,7 @@ export enum VarType {
arrayString
=
'array[string]'
,
arrayNumber
=
'array[number]'
,
arrayObject
=
'array[object]'
,
arrayFile
=
'array[file]'
,
}
export
type
Var
=
{
...
...
web/i18n/en-US/workflow.ts
View file @
801160c4
...
...
@@ -245,6 +245,16 @@ const translation = {
tool
:
{
toAuthorize
:
'To authorize'
,
inputVars
:
'Input Variables'
,
outputVars
:
{
text
:
'tool generated content'
,
files
:
{
title
:
'tool generated files'
,
type
:
'Support type. Now only support image'
,
transfer_method
:
'Transfer method.Value is remote_url or local_file'
,
url
:
'Image url'
,
upload_file_id
:
'Upload file id'
,
},
},
},
questionClassifiers
:
{
model
:
'model'
,
...
...
web/i18n/zh-Hans/workflow.ts
View file @
801160c4
...
...
@@ -245,6 +245,16 @@ const translation = {
tool
:
{
toAuthorize
:
'授权'
,
inputVars
:
'输入变量'
,
outputVars
:
{
text
:
'工具生成的内容'
,
files
:
{
title
:
'工具生成的文件'
,
type
:
'支持类型。现在只支持图片'
,
transfer_method
:
'传输方式。值为 remote_url 或 local_file'
,
url
:
'图片链接'
,
upload_file_id
:
'上传文件ID'
,
},
},
},
questionClassifiers
:
{
model
:
'模型'
,
...
...
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