fix(web): 修复模板节点没有输出

This commit is contained in:
2025-07-13 22:24:40 +08:00
parent e798332828
commit f6e9c9bc70

View File

@@ -1,10 +1,10 @@
import type {NodeProps} from '@xyflow/react'
import {Tag} from 'antd'
import React, {useCallback} from 'react'
import React, {useCallback, useEffect} from 'react'
import {useContextStore} from '../store/ContextStore.ts'
import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts'
import AmisNode, {EndNodeHandler, inputsFormColumns} from './AmisNode.tsx'
import AmisNode, {inputsFormColumns, NormalNodeHandler, outputsFormColumns} from './AmisNode.tsx'
const typeMap: Record<string, string> = {
default: '默认',
@@ -15,11 +15,24 @@ const typeMap: Record<string, string> = {
const TemplateNode = (props: NodeProps) => {
const {getNodes, getEdges} = useFlowStore()
const {getData, getDataById} = useDataStore()
const {getData, getDataById, mergeDataById} = useDataStore()
const {getInputSchema} = useContextStore()
const nodeData = getDataById(props.id)
useEffect(() => {
mergeDataById(
props.id,
{
outputs: {
text: {
type: 'string',
},
},
},
)
}, [props.id])
const columnsSchema = useCallback(
() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
@@ -55,6 +68,7 @@ const TemplateNode = (props: NodeProps) => {
min_height: 500,
},
},
...outputsFormColumns(false, true),
],
[props.id],
)
@@ -71,7 +85,7 @@ const TemplateNode = (props: NodeProps) => {
: <></>
}
columnSchema={columnsSchema}
handler={<EndNodeHandler/>}
handler={<NormalNodeHandler/>}
/>
)
}