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
4364775d
Commit
4364775d
authored
Feb 20, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: output vars
parent
2a196e91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
1 deletion
+74
-1
output-vars.tsx
...omponents/workflow/nodes/_base/components/output-vars.tsx
+50
-0
var-reference-popup.tsx
...w/nodes/_base/components/variable/var-reference-popup.tsx
+1
-1
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+16
-0
workflow.en.ts
web/i18n/lang/workflow.en.ts
+7
-0
No files found.
web/app/components/workflow/nodes/_base/components/output-vars.tsx
0 → 100644
View file @
4364775d
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
type
Props
=
{
className
?:
string
children
:
JSX
.
Element
}
const
OutputVars
:
FC
<
Props
>
=
({
className
,
children
,
})
=>
{
const
{
t
}
=
useTranslation
()
return
(
<
div
>
<
div
className=
{
cn
(
className
,
'leading-[18px] text-[13px] font-semibold text-gray-700 uppercase'
)
}
>
{
t
(
'workflow.nodes.common.outputVars'
)
}
</
div
>
<
div
className=
'mt-2 space-y-1'
>
{
children
}
</
div
>
</
div
>
)
}
type
VarItemProps
=
{
name
:
string
type
:
string
description
:
string
}
export
const
VarItem
:
FC
<
VarItemProps
>
=
({
name
,
type
,
description
,
})
=>
{
return
(
<
div
className=
'py-1'
>
<
div
className=
'flex leading-[18px]'
>
<
div
className=
'text-[13px] font-medium text-gray-900'
>
{
name
}
</
div
>
<
div
className=
'ml-2 text-xs font-normal text-gray-500 capitalize'
>
{
type
}
</
div
>
</
div
>
<
div
className=
'mt-0.5 leading-[18px] text-xs font-normal text-gray-600'
>
{
description
}
</
div
>
</
div
>
)
}
export
default
React
.
memo
(
OutputVars
)
web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx
View file @
4364775d
...
@@ -47,7 +47,7 @@ const Item: FC<ItemProps> = ({
...
@@ -47,7 +47,7 @@ const Item: FC<ItemProps> = ({
<
Variable02
className=
'shrink-0 w-3.5 h-3.5 text-primary-500'
/>
<
Variable02
className=
'shrink-0 w-3.5 h-3.5 text-primary-500'
/>
<
div
className=
'ml-1 w-0 grow text-ellipsis text-[13px] font-normal text-gray-900'
>
{
itemData
.
variable
}
</
div
>
<
div
className=
'ml-1 w-0 grow text-ellipsis text-[13px] font-normal text-gray-900'
>
{
itemData
.
variable
}
</
div
>
</
div
>
</
div
>
<
div
className=
'ml-1 shrink-0 text-xs font-normal text-gray-500'
>
{
itemData
.
type
}
</
div
>
<
div
className=
'ml-1 shrink-0 text-xs font-normal text-gray-500
capitalize
'
>
{
itemData
.
type
}
</
div
>
{
isObj
&&
(
{
isObj
&&
(
<
ChevronRight
className=
'ml-0.5 w-3 h-3 text-gray-500'
/>
<
ChevronRight
className=
'ml-0.5 w-3 h-3 text-gray-500'
/>
)
}
)
}
...
...
web/app/components/workflow/nodes/llm/panel.tsx
View file @
4364775d
...
@@ -8,6 +8,7 @@ import AddButton from '@/app/components/base/button/add-button'
...
@@ -8,6 +8,7 @@ import AddButton from '@/app/components/base/button/add-button'
import
Split
from
'@/app/components/workflow/nodes/_base/components/split'
import
Split
from
'@/app/components/workflow/nodes/_base/components/split'
import
ModelParameterModal
from
'@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import
ModelParameterModal
from
'@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import
Switch
from
'@/app/components/base/switch'
import
Switch
from
'@/app/components/base/switch'
import
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
const
i18nPrefix
=
'workflow.nodes.llm'
const
i18nPrefix
=
'workflow.nodes.llm'
...
@@ -94,6 +95,21 @@ const Panel: FC = () => {
...
@@ -94,6 +95,21 @@ const Panel: FC = () => {
>
>
Functions
Functions
</Field> */
}
</Field> */
}
<
OutputVars
>
<>
<
VarItem
name=
'output'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.output`
)
}
/>
<
VarItem
name=
'usage'
type=
'object'
description=
{
t
(
`${i18nPrefix}.outputVars.usage`
)
}
/>
</>
</
OutputVars
>
</
div
>
</
div
>
)
)
}
}
...
...
web/i18n/lang/workflow.en.ts
View file @
4364775d
const
translation
=
{
const
translation
=
{
nodes
:
{
nodes
:
{
common
:
{
outputVars
:
'Output Variables'
,
},
llm
:
{
llm
:
{
model
:
'model'
,
model
:
'model'
,
variables
:
'variables'
,
variables
:
'variables'
,
context
:
'context'
,
context
:
'context'
,
prompt
:
'prompt'
,
prompt
:
'prompt'
,
vision
:
'vision'
,
vision
:
'vision'
,
outputVars
:
{
output
:
'Generate content'
,
usage
:
'Model Usage Information'
,
},
},
},
},
},
}
}
...
...
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