feat(web): 完成分支节点动态改变handle
This commit is contained in:
@@ -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/>}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user