mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
fix: var assigner
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { useState } from 'react'
|
|
||||||
import type { NodeProps } from 'reactflow'
|
import type { NodeProps } from 'reactflow'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { NodeTargetHandle } from '../_base/components/node-handle'
|
import { NodeTargetHandle } from '../_base/components/node-handle'
|
||||||
@ -13,8 +12,7 @@ const i18nPrefix = 'workflow.nodes.variableAssigner'
|
|||||||
const Node: FC<NodeProps<VariableAssignerNodeType>> = (props) => {
|
const Node: FC<NodeProps<VariableAssignerNodeType>> = (props) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { data } = props
|
const { data } = props
|
||||||
const { variables: tempVar, output_type } = data
|
const { variables, output_type } = data
|
||||||
const [variables, setVariables] = useState(tempVar)
|
|
||||||
|
|
||||||
// TODO: get var type through node and value
|
// TODO: get var type through node and value
|
||||||
const getVarType = () => {
|
const getVarType = () => {
|
||||||
@ -65,13 +63,6 @@ const Node: FC<NodeProps<VariableAssignerNodeType>> = (props) => {
|
|||||||
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{/* For test */}
|
|
||||||
<div
|
|
||||||
className='mt-1 flex items-center h-6 justify-center bg-gray-100 rounded-md px-1 space-x-1 text-xs font-normal text-gray-700'
|
|
||||||
onClick={() => {
|
|
||||||
setVariables([...variables, []])
|
|
||||||
}}
|
|
||||||
>Add</div>
|
|
||||||
<div className='mt-2 flex items-center h-6 justify-between bg-gray-100 rounded-md px-1 space-x-1 text-xs font-normal text-gray-700'>
|
<div className='mt-2 flex items-center h-6 justify-between bg-gray-100 rounded-md px-1 space-x-1 text-xs font-normal text-gray-700'>
|
||||||
<div className='text-xs font-medium text-gray-500 uppercase'>
|
<div className='text-xs font-medium text-gray-500 uppercase'>
|
||||||
{t(`${i18nPrefix}.outputType`)}
|
{t(`${i18nPrefix}.outputType`)}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ const Panel: FC<NodeProps<VariableAssignerNodeType>> = ({
|
|||||||
const typeOptions = [
|
const typeOptions = [
|
||||||
{ label: t(`${i18nPrefix}.type.string`), value: 'string' },
|
{ label: t(`${i18nPrefix}.type.string`), value: 'string' },
|
||||||
{ label: t(`${i18nPrefix}.type.number`), value: 'number' },
|
{ label: t(`${i18nPrefix}.type.number`), value: 'number' },
|
||||||
{ label: t(`${i18nPrefix}.type.object`), value: 'Object' },
|
{ label: t(`${i18nPrefix}.type.object`), value: 'object' },
|
||||||
{ label: t(`${i18nPrefix}.type.array`), value: 'array' },
|
{ label: t(`${i18nPrefix}.type.array`), value: 'array' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user