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
5817a035
Commit
5817a035
authored
Feb 22, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: start build in vars show
parent
ea76f462
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
3 deletions
+108
-3
output-vars.tsx
...omponents/workflow/nodes/_base/components/output-vars.tsx
+24
-2
panel.tsx
web/app/components/workflow/nodes/start/panel.tsx
+52
-1
use-config.ts
web/app/components/workflow/nodes/start/use-config.ts
+12
-0
workflow.en.ts
web/i18n/lang/workflow.en.ts
+10
-0
workflow.zh.ts
web/i18n/lang/workflow.zh.ts
+10
-0
No files found.
web/app/components/workflow/nodes/_base/components/output-vars.tsx
View file @
5817a035
...
@@ -6,11 +6,13 @@ import cn from 'classnames'
...
@@ -6,11 +6,13 @@ import cn from 'classnames'
type
Props
=
{
type
Props
=
{
className
?:
string
className
?:
string
title
?:
string
children
:
JSX
.
Element
children
:
JSX
.
Element
}
}
const
OutputVars
:
FC
<
Props
>
=
({
const
OutputVars
:
FC
<
Props
>
=
({
className
,
className
,
title
,
children
,
children
,
})
=>
{
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
...
@@ -18,7 +20,7 @@ const OutputVars: FC<Props> = ({
...
@@ -18,7 +20,7 @@ const OutputVars: FC<Props> = ({
return
(
return
(
<
div
>
<
div
>
<
div
className=
{
cn
(
className
,
'leading-[18px] text-[13px] font-semibold text-gray-700 uppercase'
)
}
>
<
div
className=
{
cn
(
className
,
'leading-[18px] text-[13px] font-semibold text-gray-700 uppercase'
)
}
>
{
t
(
'workflow.nodes.common.outputVars'
)
}
{
t
itle
||
t
(
'workflow.nodes.common.outputVars'
)
}
</
div
>
</
div
>
<
div
className=
'mt-2 space-y-1'
>
<
div
className=
'mt-2 space-y-1'
>
{
children
}
{
children
}
...
@@ -30,12 +32,18 @@ type VarItemProps = {
...
@@ -30,12 +32,18 @@ type VarItemProps = {
name
:
string
name
:
string
type
:
string
type
:
string
description
:
string
description
:
string
subItems
?:
{
name
:
string
type
:
string
description
:
string
}[]
}
}
export
const
VarItem
:
FC
<
VarItemProps
>
=
({
export
const
VarItem
:
FC
<
VarItemProps
>
=
({
name
,
name
,
type
,
type
,
description
,
description
,
subItems
,
})
=>
{
})
=>
{
return
(
return
(
<
div
className=
'py-1'
>
<
div
className=
'py-1'
>
...
@@ -43,7 +51,21 @@ export const VarItem: FC<VarItemProps> = ({
...
@@ -43,7 +51,21 @@ export const VarItem: FC<VarItemProps> = ({
<
div
className=
'text-[13px] font-medium text-gray-900'
>
{
name
}
</
div
>
<
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
className=
'ml-2 text-xs font-normal text-gray-500 capitalize'
>
{
type
}
</
div
>
</
div
>
</
div
>
<
div
className=
'mt-0.5 leading-[18px] text-xs font-normal text-gray-600'
>
{
description
}
</
div
>
<
div
className=
'mt-0.5 leading-[18px] text-xs font-normal text-gray-600'
>
{
description
}
{
subItems
&&
(
<
div
className=
'ml-2 border-l border-gray-200 pl-2'
>
{
subItems
.
map
((
item
,
index
)
=>
(
<
VarItem
key=
{
index
}
name=
{
item
.
name
}
type=
{
item
.
type
}
description=
{
item
.
description
}
/>
))
}
</
div
>
)
}
</
div
>
</
div
>
</
div
>
)
)
}
}
...
...
web/app/components/workflow/nodes/start/panel.tsx
View file @
5817a035
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
Split
from
'@/app/components/workflow/nodes/_base/components/split'
import
Field
from
'@/app/components/workflow/nodes/_base/components/field'
import
OutputVars
,
{
VarItem
}
from
'@/app/components/workflow/nodes/_base/components/output-vars'
const
i18nPrefix
=
'workflow.nodes.start'
const
Panel
:
FC
=
()
=>
{
const
Panel
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
return
(
return
(
<
div
>
start panel inputs
</
div
>
<
div
className=
'mt-2'
>
<
div
className=
'px-4 pb-4 space-y-4'
>
<
Field
title=
{
t
(
`${i18nPrefix}.model`
)
}
>
ss
</
Field
>
</
div
>
<
Split
/>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
title=
{
t
(
`${i18nPrefix}.builtInVar`
)
!
}
>
<>
<
VarItem
name=
'sys.query'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.query`
)
}
/>
<
VarItem
name=
'sys.memories'
type=
'array[Object]'
description=
{
t
(
`${i18nPrefix}.outputVars.memories.des`
)
}
subItems=
{
[
{
name
:
'type'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.memories.type`
),
},
{
name
:
'content'
,
type
:
'string'
,
description
:
t
(
`${i18nPrefix}.outputVars.memories.content`
),
},
]
}
/>
<
VarItem
name=
'sys.files'
type=
'string'
description=
{
t
(
`${i18nPrefix}.outputVars.files`
)
}
/>
</>
</
OutputVars
>
</
div
>
</
div
>
)
)
}
}
...
...
web/app/components/workflow/nodes/start/use-config.ts
0 → 100644
View file @
5817a035
import
{
useState
}
from
'react'
import
type
{
StartNodeType
}
from
'./types'
const
useConfig
=
(
initInputs
:
StartNodeType
)
=>
{
const
[
inputs
,
setInputs
]
=
useState
<
StartNodeType
>
(
initInputs
)
return
{
inputs
,
}
}
export
default
useConfig
web/i18n/lang/workflow.en.ts
View file @
5817a035
...
@@ -6,6 +6,16 @@ const translation = {
...
@@ -6,6 +6,16 @@ const translation = {
},
},
start
:
{
start
:
{
required
:
'required'
,
required
:
'required'
,
builtInVar
:
'Built-in Variables'
,
outputVars
:
{
query
:
'User input'
,
memories
:
{
des
:
'Conversation history'
,
type
:
'message type'
,
content
:
'message content'
,
},
files
:
'File list'
,
},
},
},
end
:
{
end
:
{
outputs
:
'Outputs'
,
outputs
:
'Outputs'
,
...
...
web/i18n/lang/workflow.zh.ts
View file @
5817a035
...
@@ -6,6 +6,16 @@ const translation = {
...
@@ -6,6 +6,16 @@ const translation = {
},
},
start
:
{
start
:
{
required
:
'必填'
,
required
:
'必填'
,
builtInVar
:
'内置变量'
,
outputVars
:
{
query
:
'用户输入'
,
memories
:
{
des
:
'会话历史'
,
type
:
'消息类型'
,
content
:
'消息内容'
,
},
files
:
'文件列表'
,
},
},
},
end
:
{
end
:
{
outputs
:
'输出'
,
outputs
:
'输出'
,
...
...
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