mirror of https://github.com/langgenius/dify.git
feat: input no var tip
This commit is contained in:
parent
e7ecdb01a6
commit
307cbf1d9f
|
|
@ -2,8 +2,10 @@
|
|||
import type { FC } from 'react'
|
||||
import React, { useCallback } from 'react'
|
||||
import produce from 'immer'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import VarItem from './var-item'
|
||||
import type { InputVar } from '@/app/components/workflow/types'
|
||||
|
||||
type Props = {
|
||||
readonly: boolean
|
||||
list: InputVar[]
|
||||
|
|
@ -15,6 +17,8 @@ const VarList: FC<Props> = ({
|
|||
list,
|
||||
onChange,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const handleVarNameChange = useCallback((index: number) => {
|
||||
return (payload: InputVar) => {
|
||||
const newList = produce(list, (draft) => {
|
||||
|
|
@ -33,6 +37,14 @@ const VarList: FC<Props> = ({
|
|||
}
|
||||
}, [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.start.noVarTip')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='space-y-1'>
|
||||
{list.map((item, index) => (
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const translation = {
|
|||
},
|
||||
files: 'File list',
|
||||
},
|
||||
noVarTip: 'Set inputs that can be used in the Workflow',
|
||||
},
|
||||
end: {
|
||||
outputs: 'Outputs',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const translation = {
|
|||
},
|
||||
files: '文件列表',
|
||||
},
|
||||
noVarTip: '设置的输入可在工作流程中使用',
|
||||
},
|
||||
end: {
|
||||
outputs: '输出',
|
||||
|
|
|
|||
Loading…
Reference in New Issue