feat(ai-web): 输出节点改为多变量输出
This commit is contained in:
@@ -10,10 +10,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
*/
|
||||
@Slf4j
|
||||
public class OutputNode extends FlowNodeRunner {
|
||||
private static final String KEY = "flow_outputs";
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String expression = getData("output");
|
||||
var targetVariable = FlowHelper.generateVariable(expression, getContext());
|
||||
log.info("Target: {}", targetVariable);
|
||||
var variableMap = FlowHelper.generateInputVariablesMap(getNodeId(), getContext());
|
||||
getContext().getData().put(KEY, variableMap.toMap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,16 @@
|
||||
import type {NodeProps} from '@xyflow/react'
|
||||
import React, {useCallback} from 'react'
|
||||
import {generateAllIncomerOutputVariablesFormOptions} from '../Helper.tsx'
|
||||
import {useDataStore} from '../store/DataStore.ts'
|
||||
import {useFlowStore} from '../store/FlowStore.ts'
|
||||
import AmisNode, {EndNodeHandler, nodeClassName} from './AmisNode.tsx'
|
||||
import type {FormSchema} from '../types.ts'
|
||||
import AmisNode, {EndNodeHandler, inputsFormColumns, nodeClassName} from './AmisNode.tsx'
|
||||
|
||||
const OutputNode = (props: NodeProps) => {
|
||||
const {getNodes, getEdges} = useFlowStore()
|
||||
const {getData} = useDataStore()
|
||||
|
||||
const formSchema: () => FormSchema = useCallback(() => ({
|
||||
columns: [
|
||||
{
|
||||
type: 'select',
|
||||
name: 'output',
|
||||
label: '输出变量',
|
||||
required: true,
|
||||
selectMode: 'group',
|
||||
options: generateAllIncomerOutputVariablesFormOptions(
|
||||
props.id,
|
||||
getNodes(),
|
||||
getEdges(),
|
||||
getData(),
|
||||
),
|
||||
},
|
||||
]
|
||||
columns: inputsFormColumns(props.id, getNodes(), getEdges(), getData()),
|
||||
}), [props.id])
|
||||
|
||||
return (
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user