feat: answer node input limit

This commit is contained in:
Joel 2024-03-15 17:54:40 +08:00
parent d0ef9e672f
commit 9f1cbb2ee7
4 changed files with 10 additions and 2 deletions

View File

@ -118,7 +118,7 @@ const VarReferencePopup: FC<Props> = ({
itemWidth,
}) => {
const { t } = useTranslation()
// max-h-[300px] overflow-y-auto todo: use portal to handle long list
return (
<div className='p-1 bg-white rounded-lg border border-gray-200 shadow-lg space-y-1' style={{
width: itemWidth || 228,

View File

@ -128,7 +128,6 @@ const useOneStepRun = <T>({
const isCompleted = runningStatus === NodeRunningStatus.Succeeded || runningStatus === NodeRunningStatus.Failed
const handleRun = async (submitData: Record<string, any>) => {
console.log(submitData)
handleNodeDataUpdate({
id,
data: {

View File

@ -24,6 +24,7 @@ const Panel: FC<NodePanelProps<AnswerNodeType>> = ({
handleVarListChange,
handleAddVariable,
handleAnswerChange,
filterVar,
} = useConfig(id, data)
return (
@ -39,6 +40,7 @@ const Panel: FC<NodePanelProps<AnswerNodeType>> = ({
readonly={readOnly}
list={inputs.variables}
onChange={handleVarListChange}
filterVar={filterVar}
/>
</Field>
<Split />

View File

@ -1,6 +1,8 @@
import { useCallback } from 'react'
import produce from 'immer'
import useVarList from '../_base/hooks/use-var-list'
import type { Var } from '../../types'
import { VarType } from '../../types'
import type { AnswerNodeType } from './types'
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
@ -18,11 +20,16 @@ const useConfig = (id: string, payload: AnswerNodeType) => {
})
setInputs(newInputs)
}, [inputs, setInputs])
const filterVar = useCallback((varPayload: Var) => {
return varPayload.type !== VarType.arrayObject
}, [])
return {
inputs,
handleVarListChange,
handleAddVariable,
handleAnswerChange,
filterVar,
}
}