feat(web): 完成子流程节点和代码节点的运行
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import {type Edge, getIncomers, type Node} from '@xyflow/react'
|
||||
import type {Option} from 'amis/lib/Schema'
|
||||
import {find, has, isEqual, max, min, unique} from 'licia'
|
||||
import {contain, find, has, isEqual, max, min, unique} from 'licia'
|
||||
import {type DependencyList, type MouseEvent as ReactMouseEvent, useCallback, useRef} from 'react'
|
||||
import Queue from 'yocto-queue'
|
||||
import {originTypeMap} from '../../pages/ai/task/InputSchema.tsx'
|
||||
import {useFlowStore} from './store/FlowStore.ts'
|
||||
import {type OutputVariable} from './types.ts'
|
||||
import {type OutputVariable, type OutputVariableType} from './types.ts'
|
||||
|
||||
export const getAllIncomerNodeById: (id: string, nodes: Node[], edges: Edge[]) => string[] = (id, nodes, edges) => {
|
||||
let queue = new Queue<Node>()
|
||||
@@ -82,9 +82,12 @@ export const getAllIncomerNodeOutputVariables: (id: string, inputSchema: Record<
|
||||
]
|
||||
}
|
||||
|
||||
export const generateAllIncomerOutputVariablesFormOptions: (id: string, inputSchema: Record<string, Record<string, any>>, nodes: Node[], edges: Edge[], data: any) => Option[] = (id, inputSchema, nodes, edges, data) => {
|
||||
export const generateAllIncomerOutputVariablesFormOptions: (id: string, inputSchema: Record<string, Record<string, any>>, nodes: Node[], edges: Edge[], data: any, targetTypes?: OutputVariableType[]) => Option[] = (id, inputSchema, nodes, edges, data, targetTypes) => {
|
||||
let optionMap: Record<string, Option[]> = {}
|
||||
for (const item of getAllIncomerNodeOutputVariables(id, inputSchema, nodes, edges, data)) {
|
||||
if (targetTypes && !contain(targetTypes, item.type)) {
|
||||
continue
|
||||
}
|
||||
if (!optionMap[item.group]) {
|
||||
optionMap[item.group] = []
|
||||
}
|
||||
@@ -142,7 +145,7 @@ export const generateAllIncomerOutputVariablesConditions: (id: string, inputSche
|
||||
options: [
|
||||
{label: '真', value: true},
|
||||
{label: '假', value: false},
|
||||
]
|
||||
],
|
||||
},
|
||||
defaultOp: booleanDefaultOperator,
|
||||
operators: booleanOperators,
|
||||
|
||||
Reference in New Issue
Block a user