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