mirror of https://github.com/langgenius/dify.git
chore: assigner node
This commit is contained in:
parent
14eb5b7930
commit
cf63926e16
|
|
@ -81,6 +81,7 @@ import { supportFunctionCall } from '@/utils/tool-call'
|
|||
import { MittProvider } from '@/context/mitt-context'
|
||||
import { fetchAndMergeValidCompletionParams } from '@/utils/completion-params'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { fetchCollectionList } from '@/service/tools'
|
||||
|
||||
type PublishConfig = {
|
||||
modelConfig: ModelConfig
|
||||
|
|
@ -520,8 +521,7 @@ const Configuration: FC = () => {
|
|||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
// const collectionList = await fetchCollectionList()
|
||||
const collectionList: any[] = [] // this api has problem in dev, so comment it for temporarily
|
||||
const collectionList = await fetchCollectionList()
|
||||
if (basePath) {
|
||||
collectionList.forEach((item) => {
|
||||
if (typeof item.icon == 'string' && !item.icon.includes(basePath))
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ const FormItem: FC<Props> = ({
|
|||
)
|
||||
}
|
||||
|
||||
{ isBooleanType && (
|
||||
{isBooleanType && (
|
||||
<BoolInput
|
||||
name={payload.label as string}
|
||||
value={!!value}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import Input from '@/app/components/base/input'
|
|||
import Textarea from '@/app/components/base/textarea'
|
||||
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
||||
import { noop } from 'lodash-es'
|
||||
import BoolValue from '@/app/components/workflow/panel/chat-variable-panel/components/bool-value'
|
||||
|
||||
type Props = {
|
||||
readonly: boolean
|
||||
|
|
@ -75,7 +76,7 @@ const VarList: FC<Props> = ({
|
|||
}, [list, onChange])
|
||||
|
||||
const handleToAssignedVarChange = useCallback((index: number) => {
|
||||
return (value: ValueSelector | string | number) => {
|
||||
return (value: ValueSelector | string | number | boolean) => {
|
||||
const newList = produce(list, (draft) => {
|
||||
draft[index].value = value as ValueSelector
|
||||
})
|
||||
|
|
@ -188,6 +189,12 @@ const VarList: FC<Props> = ({
|
|||
className='w-full'
|
||||
/>
|
||||
)}
|
||||
{assignedVarType === 'boolean' && (
|
||||
<BoolValue
|
||||
value={item.value as boolean}
|
||||
onChange={value => handleToAssignedVarChange(index)(value)}
|
||||
/>
|
||||
)}
|
||||
{assignedVarType === 'object' && (
|
||||
<CodeEditor
|
||||
value={item.value as string}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export const getOperationItems = (
|
|||
]
|
||||
}
|
||||
|
||||
if (writeModeTypes && ['string', 'object'].includes(assignedVarType || '')) {
|
||||
if (writeModeTypes && ['string', 'boolean', 'object'].includes(assignedVarType || '')) {
|
||||
return writeModeTypes.map(type => ({
|
||||
value: type,
|
||||
name: type,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BlockEnum, type NodeDefault } from '../../types'
|
||||
import { BlockEnum, type NodeDefault, VarType } from '../../types'
|
||||
import { type IfElseNodeType, LogicalOperator } from './types'
|
||||
import { isEmptyRelatedOperator } from './utils'
|
||||
import { ALL_CHAT_AVAILABLE_BLOCKS, ALL_COMPLETION_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks'
|
||||
|
|
@ -64,7 +64,7 @@ const nodeDefault: NodeDefault<IfElseNodeType> = {
|
|||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||
}
|
||||
else {
|
||||
if (!isEmptyRelatedOperator(condition.comparison_operator!) && !condition.value)
|
||||
if (!isEmptyRelatedOperator(condition.comparison_operator!) && (condition.varType === VarType.boolean ? condition.value === undefined : !condition.value))
|
||||
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t(`${i18nPrefix}.fields.variableValue`) })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue