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
32c6431d
Commit
32c6431d
authored
Feb 27, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: assign node no var list tip
parent
925964ac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
2 deletions
+14
-2
page.tsx
web/app/(commonLayout)/workflow/nodes/page.tsx
+2
-2
index.tsx
...low/nodes/variable-assigner/components/var-list/index.tsx
+10
-0
workflow.ts
web/i18n/en-US/workflow.ts
+1
-0
workflow.ts
web/i18n/zh-Hans/workflow.ts
+1
-0
No files found.
web/app/(commonLayout)/workflow/nodes/page.tsx
View file @
32c6431d
...
@@ -5,9 +5,9 @@ import { memo } from 'react'
...
@@ -5,9 +5,9 @@ import { memo } from 'react'
import
Workflow
from
'@/app/components/workflow'
import
Workflow
from
'@/app/components/workflow'
import
{
BlockEnum
}
from
'@/app/components/workflow/types'
import
{
BlockEnum
}
from
'@/app/components/workflow/types'
const
nodes
=
[
const
nodes
=
[
BlockEnum
.
Start
/* 1 */
,
BlockEnum
.
DirectAnswer
/* 2 */
,
BlockEnum
.
LLM
/* 3 */
,
BlockEnum
.
KnowledgeRetrieval
/* 4 */
,
BlockEnum
.
QuestionClassifier
/* 5 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
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
.
IfElse
/* 6 */
,
BlockEnum
.
Code
/* 7 */
,
BlockEnum
.
TemplateTransform
/* 8 */
,
BlockEnum
.
HttpRequest
/* 9 */
,
BlockEnum
.
Tool
/* 10 */
,
BlockEnum
.
VariableAssigner
/* 11 */
,
BlockEnum
.
End
/* 12 */
,
BlockEnum
.
End
/* 12 */
,
].
map
((
item
,
i
)
=>
({
].
map
((
item
,
i
)
=>
({
id
:
`
${
i
+
1
}
`
,
id
:
`
${
i
+
1
}
`
,
type
:
'custom'
,
type
:
'custom'
,
...
...
web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
View file @
32c6431d
'use client'
'use client'
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
React
,
{
useCallback
}
from
'react'
import
React
,
{
useCallback
}
from
'react'
import
produce
from
'immer'
import
produce
from
'immer'
import
VarReferencePicker
from
'@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
import
VarReferencePicker
from
'@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
...
@@ -17,6 +18,7 @@ const VarList: FC<Props> = ({
...
@@ -17,6 +18,7 @@ const VarList: FC<Props> = ({
list
,
list
,
onChange
,
onChange
,
})
=>
{
})
=>
{
const
{
t
}
=
useTranslation
()
const
handleVarReferenceChange
=
useCallback
((
index
:
number
)
=>
{
const
handleVarReferenceChange
=
useCallback
((
index
:
number
)
=>
{
return
(
value
:
ValueSelector
)
=>
{
return
(
value
:
ValueSelector
)
=>
{
const
newList
=
produce
(
list
,
(
draft
)
=>
{
const
newList
=
produce
(
list
,
(
draft
)
=>
{
...
@@ -35,6 +37,14 @@ const VarList: FC<Props> = ({
...
@@ -35,6 +37,14 @@ const VarList: FC<Props> = ({
}
}
},
[
list
,
onChange
])
},
[
list
,
onChange
])
if
(
list
.
length
===
0
)
{
return
(
<
div
className=
'flex rounded-md bg-gray-50 items-center h-[42px] justify-center leading-[18px] text-xs font-normal text-gray-500'
>
{
t
(
'workflow.nodes.variableAssigner.noVarTip'
)
}
</
div
>
)
}
return
(
return
(
<
div
className=
'space-y-2'
>
<
div
className=
'space-y-2'
>
{
list
.
map
((
item
,
index
)
=>
(
{
list
.
map
((
item
,
index
)
=>
(
...
...
web/i18n/en-US/workflow.ts
View file @
32c6431d
...
@@ -92,6 +92,7 @@ const translation = {
...
@@ -92,6 +92,7 @@ const translation = {
outputType
:
'Output Type'
,
outputType
:
'Output Type'
,
outputVarType
:
'Output Variable Type'
,
outputVarType
:
'Output Variable Type'
,
varNotSet
:
'Variable not set'
,
varNotSet
:
'Variable not set'
,
noVarTip
:
'Add the variables to be assigned'
,
type
:
{
type
:
{
string
:
'String'
,
string
:
'String'
,
number
:
'Number'
,
number
:
'Number'
,
...
...
web/i18n/zh-Hans/workflow.ts
View file @
32c6431d
...
@@ -91,6 +91,7 @@ const translation = {
...
@@ -91,6 +91,7 @@ const translation = {
outputType
:
'输出类型'
,
outputType
:
'输出类型'
,
outputVarType
:
'输出变量类型'
,
outputVarType
:
'输出变量类型'
,
varNotSet
:
'未设置变量'
,
varNotSet
:
'未设置变量'
,
noVarTip
:
'添加需要赋值的变量'
,
type
:
{
type
:
{
string
:
'String'
,
string
:
'String'
,
number
:
'Number'
,
number
:
'Number'
,
...
...
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