mirror of https://github.com/langgenius/dify.git
feat: assign node no var list tip
This commit is contained in:
parent
925964ac28
commit
32c6431dbc
|
|
@ -5,9 +5,9 @@ import { memo } from 'react'
|
|||
import Workflow from '@/app/components/workflow'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
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.VariableAssigner/* 11 */, BlockEnum.End/* 12 */,
|
||||
BlockEnum.End/* 12 */,
|
||||
].map((item, i) => ({
|
||||
id: `${i + 1}`,
|
||||
type: 'custom',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import React, { useCallback } from 'react'
|
||||
import produce from 'immer'
|
||||
import VarReferencePicker from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
|
||||
|
|
@ -17,6 +18,7 @@ const VarList: FC<Props> = ({
|
|||
list,
|
||||
onChange,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const handleVarReferenceChange = useCallback((index: number) => {
|
||||
return (value: ValueSelector) => {
|
||||
const newList = produce(list, (draft) => {
|
||||
|
|
@ -35,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.variableAssigner.noVarTip')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='space-y-2'>
|
||||
{list.map((item, index) => (
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ const translation = {
|
|||
outputType: 'Output Type',
|
||||
outputVarType: 'Output Variable Type',
|
||||
varNotSet: 'Variable not set',
|
||||
noVarTip: 'Add the variables to be assigned',
|
||||
type: {
|
||||
string: 'String',
|
||||
number: 'Number',
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ const translation = {
|
|||
outputType: '输出类型',
|
||||
outputVarType: '输出变量类型',
|
||||
varNotSet: '未设置变量',
|
||||
noVarTip: '添加需要赋值的变量',
|
||||
type: {
|
||||
string: 'String',
|
||||
number: 'Number',
|
||||
|
|
|
|||
Loading…
Reference in New Issue