mirror of https://github.com/langgenius/dify.git
chore: conveersion pass boolean string boolean
This commit is contained in:
parent
5fbeb275b2
commit
590c14c977
|
|
@ -27,6 +27,7 @@ import {
|
|||
arrayStringPlaceholder,
|
||||
objectPlaceholder,
|
||||
} from '@/app/components/workflow/panel/chat-variable-panel/utils'
|
||||
import ArrayBoolList from '@/app/components/workflow/panel/chat-variable-panel/components/array-bool-list'
|
||||
|
||||
type FormItemProps = {
|
||||
nodeId: string
|
||||
|
|
@ -114,7 +115,7 @@ const FormItem = ({
|
|||
}
|
||||
{
|
||||
value_type === ValueType.constant
|
||||
&& (var_type === VarType.object || var_type === VarType.arrayString || var_type === VarType.arrayNumber || var_type === VarType.arrayObject || var_type === VarType.arrayBoolean)
|
||||
&& (var_type === VarType.object || var_type === VarType.arrayString || var_type === VarType.arrayNumber || var_type === VarType.arrayObject)
|
||||
&& (
|
||||
<div className='w-full rounded-[10px] bg-components-input-bg-normal py-2 pl-3 pr-1' style={{ height: editorMinHeight }}>
|
||||
<CodeEditor
|
||||
|
|
@ -129,6 +130,15 @@ const FormItem = ({
|
|||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
value_type === ValueType.constant && var_type === VarType.arrayBoolean && (
|
||||
<ArrayBoolList
|
||||
className='mt-2'
|
||||
list={value || ['false']}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,20 +7,23 @@ import produce from 'immer'
|
|||
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
|
||||
import Button from '@/app/components/base/button'
|
||||
import BoolValue from './bool-value'
|
||||
import cn from '@/utils/classnames'
|
||||
|
||||
type Props = {
|
||||
className?: string
|
||||
list: any[]
|
||||
onChange: (list: any[]) => void
|
||||
onChange: (list: string[]) => void
|
||||
}
|
||||
|
||||
const ArrayValueList: FC<Props> = ({
|
||||
className,
|
||||
list,
|
||||
onChange,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const handleChange = useCallback((index: number) => {
|
||||
return (value: boolean) => {
|
||||
return (value: string) => {
|
||||
const newList = produce(list, (draft: any[]) => {
|
||||
draft[index] = value
|
||||
})
|
||||
|
|
@ -39,13 +42,13 @@ const ArrayValueList: FC<Props> = ({
|
|||
|
||||
const handleItemAdd = useCallback(() => {
|
||||
const newList = produce(list, (draft: any[]) => {
|
||||
draft.push(true)
|
||||
draft.push('false')
|
||||
})
|
||||
onChange(newList)
|
||||
}, [list, onChange])
|
||||
|
||||
return (
|
||||
<div className='w-full space-y-2'>
|
||||
<div className={cn('w-full space-y-2', className)}>
|
||||
{list.map((item, index) => (
|
||||
<div className='flex items-center space-x-1' key={index}>
|
||||
<BoolValue
|
||||
|
|
|
|||
Loading…
Reference in New Issue