fix(web): 修复节点入参不更新

This commit is contained in:
2025-07-16 22:54:48 +08:00
parent a3c2250285
commit 72a9d58f4c
9 changed files with 18 additions and 20 deletions

View File

@@ -88,7 +88,7 @@ type AmisNodeProps = {
nodeProps: NodeProps
extraNodeDescription?: JSX.Element
handler: JSX.Element
columnSchema?: Schema[]
columnSchema?: () => Schema[]
resize?: { minWidth: number, minHeight: number }
}
@@ -183,7 +183,7 @@ const AmisNode: (props: AmisNodeProps) => JSX.Element = ({
{
type: 'divider',
},
...(columnSchema ?? []),
...(columnSchema?.() ?? []),
{
type: 'wrapper',
size: 'none',

View File

@@ -1,6 +1,6 @@
import type {NodeProps} from '@xyflow/react'
import {Tag} from 'antd'
import React, {useMemo} from 'react'
import React, {useCallback, useMemo} from 'react'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts'
@@ -19,7 +19,7 @@ const CodeNode = (props: NodeProps) => {
const nodeData = getDataById(props.id)
const columnsSchema = useMemo(() => [
const columnsSchema = useCallback(() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
{
type: 'divider',

View File

@@ -1,5 +1,5 @@
import type {NodeProps} from '@xyflow/react'
import React, {useEffect, useMemo} from 'react'
import React, {useCallback, useEffect} from 'react'
import {commonInfo} from '../../../util/amis.tsx'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
@@ -24,7 +24,7 @@ const KnowledgeNode = (props: NodeProps) => {
)
}, [props.id])
const columnsSchema = useMemo(() => [
const columnsSchema = useCallback(() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
{
type: 'divider',

View File

@@ -1,6 +1,6 @@
import type {NodeProps} from '@xyflow/react'
import {Tag} from 'antd'
import React, {useEffect, useMemo} from 'react'
import React, {useCallback, useEffect, useMemo} from 'react'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts'
@@ -31,7 +31,7 @@ const LlmNode = (props: NodeProps) => {
)
}, [props.id])
const columnsSchema = useMemo(() => [
const columnsSchema = useCallback(() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
{
type: 'divider',

View File

@@ -1,6 +1,6 @@
import {Background, BackgroundVariant, type NodeProps} from '@xyflow/react'
import {classnames} from 'amis'
import React, {useEffect, useMemo} from 'react'
import React, {useCallback, useEffect, useMemo} from 'react'
import AddNodeButton from '../component/AddNodeButton.tsx'
import {useDataStore} from '../store/DataStore.ts'
import {flowBackgroundColor, flowDotColor} from '../types.ts'
@@ -22,7 +22,7 @@ const LoopNode = (props: NodeProps) => {
)
}, [props.id])
const columnsSchema = useMemo(() => [
const columnsSchema = useCallback(() => [
{
type: 'switch',
name: 'failFast',

View File

@@ -1,5 +1,5 @@
import type {NodeProps} from '@xyflow/react'
import React, {useMemo} from 'react'
import React, {useCallback} from 'react'
import {generateAllIncomerOutputVariablesFormOptions} from '../Helper.tsx'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
@@ -11,7 +11,7 @@ const OutputNode = (props: NodeProps) => {
const {getData} = useDataStore()
const {getInputSchema} = useContextStore()
const columnsSchema = useMemo(
const columnsSchema = useCallback(
() => [
{
type: 'select',
@@ -27,9 +27,7 @@ const OutputNode = (props: NodeProps) => {
getData(),
),
},
],
[props.id],
)
], [props.id])
return (
<AmisNode

View File

@@ -2,7 +2,7 @@ import {Handle, type NodeProps, Position} from '@xyflow/react'
import type {ConditionValue} from 'amis'
import {Tag} from 'antd'
import {contain, isEqual} from 'licia'
import React, {useMemo} from 'react'
import React, {useCallback, useMemo} from 'react'
import {generateAllIncomerOutputVariablesConditions} from '../Helper.tsx'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
@@ -18,7 +18,7 @@ const SwitchNode = (props: NodeProps) => {
// @ts-ignore
const conditions: ConditionValue[] = nodeData?.conditions?.map(c => c.condition) ?? []
const columnsSchema = useMemo(() => [
const columnsSchema = useCallback(() => [
{
type: 'combo',
name: 'conditions',

View File

@@ -1,6 +1,6 @@
import type {NodeProps} from '@xyflow/react'
import {Tag} from 'antd'
import React, {useEffect, useMemo} from 'react'
import React, {useCallback, useEffect, useMemo} from 'react'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts'
@@ -33,7 +33,7 @@ const TemplateNode = (props: NodeProps) => {
)
}, [props.id])
const columnsSchema = useMemo(
const columnsSchema = useCallback(
() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
{