feat(web): 增加判断节点对不同类型的适配和处理
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, {useCallback} from 'react'
|
||||
import {useContextStore} from '../store/ContextStore.ts'
|
||||
import {useDataStore} from '../store/DataStore.ts'
|
||||
import {useFlowStore} from '../store/FlowStore.ts'
|
||||
@@ -14,24 +14,11 @@ const languageMap: Record<string, string> = {
|
||||
|
||||
const CodeNode = (props: NodeProps) => {
|
||||
const {getNodes, getEdges} = useFlowStore()
|
||||
const {getData, mergeDataById, getDataById} = useDataStore()
|
||||
const {getData, getDataById} = useDataStore()
|
||||
const {getInputSchema} = useContextStore()
|
||||
|
||||
const nodeData = getDataById(props.id)
|
||||
|
||||
useEffect(() => {
|
||||
mergeDataById(
|
||||
props.id,
|
||||
{
|
||||
outputs: {
|
||||
result: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}, [props.id])
|
||||
|
||||
const columnsSchema = useCallback(() => [
|
||||
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ const LlmNode = (props: NodeProps) => {
|
||||
{
|
||||
outputs: {
|
||||
text: {
|
||||
type: 'string',
|
||||
type: 'text',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,17 +26,27 @@ const SwitchNode = (props: NodeProps) => {
|
||||
|
||||
const columnsSchema = useCallback(() => [
|
||||
{
|
||||
type: 'condition-builder',
|
||||
name: 'condition',
|
||||
label: '判断条件',
|
||||
fields: generateAllIncomerOutputVariablesConditions(
|
||||
props.id,
|
||||
getInputSchema(),
|
||||
getNodes(),
|
||||
getEdges(),
|
||||
getData(),
|
||||
),
|
||||
},
|
||||
type: 'combo',
|
||||
name: 'conditions',
|
||||
label: '分支',
|
||||
multiple: true,
|
||||
required: true,
|
||||
items: [
|
||||
{
|
||||
type: 'condition-builder',
|
||||
name: 'condition',
|
||||
label: '条件',
|
||||
required: true,
|
||||
fields: generateAllIncomerOutputVariablesConditions(
|
||||
props.id,
|
||||
getInputSchema(),
|
||||
getNodes(),
|
||||
getEdges(),
|
||||
getData(),
|
||||
),
|
||||
},
|
||||
]
|
||||
}
|
||||
], [props.id])
|
||||
|
||||
return (
|
||||
|
||||
@@ -26,7 +26,7 @@ const TemplateNode = (props: NodeProps) => {
|
||||
{
|
||||
outputs: {
|
||||
text: {
|
||||
type: 'string',
|
||||
type: 'text',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user