2 Commits

Author SHA1 Message Date
v-zhangjc9
a2a8c39145 feat(ai-web): 输出节点改为多变量输出 2025-07-21 18:33:45 +08:00
v-zhangjc9
82ad3e7854 fix(web): 修复api引用错误 2025-07-21 10:08:37 +08:00
4 changed files with 8 additions and 23 deletions

View File

@@ -10,10 +10,11 @@ import lombok.extern.slf4j.Slf4j;
*/ */
@Slf4j @Slf4j
public class OutputNode extends FlowNodeRunner { public class OutputNode extends FlowNodeRunner {
private static final String KEY = "flow_outputs";
@Override @Override
public void run() { public void run() {
String expression = getData("output"); var variableMap = FlowHelper.generateInputVariablesMap(getNodeId(), getContext());
var targetVariable = FlowHelper.generateVariable(expression, getContext()); getContext().getData().put(KEY, variableMap.toMap());
log.info("Target: {}", targetVariable);
} }
} }

View File

@@ -94,7 +94,7 @@ function FlowEditor(props: FlowEditorProps) {
onConnect(connection) onConnect(connection)
} catch (e) { } catch (e) {
// @ts-ignore // @ts-ignore
messageApi.error(e.toString()) message.error(e.toString())
} }
}} }}
// @ts-ignore // @ts-ignore

View File

@@ -1,31 +1,16 @@
import type {NodeProps} from '@xyflow/react' import type {NodeProps} from '@xyflow/react'
import React, {useCallback} from 'react' import React, {useCallback} from 'react'
import {generateAllIncomerOutputVariablesFormOptions} from '../Helper.tsx'
import {useDataStore} from '../store/DataStore.ts' import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts' import {useFlowStore} from '../store/FlowStore.ts'
import AmisNode, {EndNodeHandler, nodeClassName} from './AmisNode.tsx'
import type {FormSchema} from '../types.ts' import type {FormSchema} from '../types.ts'
import AmisNode, {EndNodeHandler, inputsFormColumns, nodeClassName} from './AmisNode.tsx'
const OutputNode = (props: NodeProps) => { const OutputNode = (props: NodeProps) => {
const {getNodes, getEdges} = useFlowStore() const {getNodes, getEdges} = useFlowStore()
const {getData} = useDataStore() const {getData} = useDataStore()
const formSchema: () => FormSchema = useCallback(() => ({ const formSchema: () => FormSchema = useCallback(() => ({
columns: [ columns: inputsFormColumns(props.id, getNodes(), getEdges(), getData()),
{
type: 'select',
name: 'output',
label: '输出变量',
required: true,
selectMode: 'group',
options: generateAllIncomerOutputVariablesFormOptions(
props.id,
getNodes(),
getEdges(),
getData(),
),
},
]
}), [props.id]) }), [props.id])
return ( return (

File diff suppressed because one or more lines are too long