feat(web): 完成分支节点动态改变handle

This commit is contained in:
v-zhangjc9
2025-07-16 19:54:48 +08:00
parent 91e6f49342
commit a3c2250285
11 changed files with 138 additions and 105 deletions

View File

@@ -1,6 +1,6 @@
import type {NodeProps} from '@xyflow/react'
import {Tag} from 'antd'
import React, {useCallback, useEffect} from 'react'
import React, {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 = useCallback(() => [
const columnsSchema = useMemo(() => [
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
{
type: 'divider',
@@ -55,18 +55,21 @@ const LlmNode = (props: NodeProps) => {
},
...outputsFormColumns(false, true),
], [props.id])
const extraNodeDescription = useMemo(() => {
return nodeData?.model
? <div className="mt-2 flex justify-between">
<span></span>
<Tag className="m-0" color="blue">{modelMap[nodeData.model]}</Tag>
</div>
: <></>
}, [nodeData])
return (
<AmisNode
className={nodeClassName('llm')}
nodeProps={props}
extraNodeDescription={
nodeData?.model
? <div className="mt-2 flex justify-between">
<span></span>
<Tag className="m-0" color="blue">{modelMap[nodeData.model]}</Tag>
</div>
: <></>
}
extraNodeDescription={extraNodeDescription}
columnSchema={columnsSchema}
handler={<NormalNodeHandler/>}
/>