From 47de3cc376d3a8dd372c55ed0cc49f75a10cf660 Mon Sep 17 00:00:00 2001 From: v-zhangjc9 Date: Sat, 12 Jul 2025 21:16:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E8=BE=93=E5=87=BA=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=A2=9E=E5=8A=A0=E8=BE=93=E5=87=BA=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/flow/node/OutputNode.tsx | 57 ++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/service-web/client/src/components/flow/node/OutputNode.tsx b/service-web/client/src/components/flow/node/OutputNode.tsx index 39cecb3..13f957d 100644 --- a/service-web/client/src/components/flow/node/OutputNode.tsx +++ b/service-web/client/src/components/flow/node/OutputNode.tsx @@ -1,22 +1,75 @@ import type {NodeProps} from '@xyflow/react' +import {Tag} from 'antd' import React, {useCallback} from 'react' import {useContextStore} from '../store/ContextStore.ts' import {useDataStore} from '../store/DataStore.ts' import {useFlowStore} from '../store/FlowStore.ts' import AmisNode, {EndNodeHandler, inputsFormColumns} from './AmisNode.tsx' +const typeMap: Record = { + markdown: 'Markdown', + json: 'JSON', + 'template-markdown': 'Markdown 模板', + 'template-rich-text': '富文本模板', +} + const OutputNode = (props: NodeProps) => { const {getNodes, getEdges} = useFlowStore() - const {getData} = useDataStore() + const {getData, getDataById} = useDataStore() const {getInputSchema} = useContextStore() + + const nodeData = getDataById(props.id) + const columnsSchema = useCallback( - () => inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()), + () => [ + ...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()), + { + type: 'divider', + }, + { + type: 'select', + name: 'type', + label: '输出类型', + required: true, + selectFirst: true, + options: Object.keys(typeMap).map(key => ({label: typeMap[key], value: key})), + }, + { + visibleOn: 'type === \'template-markdown\'', + type: 'editor', + required: true, + label: '模板内容', + name: 'template', + language: 'markdown', + options: { + wordWrap: 'bounded', + }, + }, + { + visibleOn: 'type === \'template-rich-text\'', + type: 'input-rich-text', + required: true, + name: 'template', + label: '模板内容', + options: { + min_height: 500, + }, + }, + ], [props.id], ) return ( + 输出类型 + {typeMap[nodeData.type]} + + : <> + } columnSchema={columnsSchema} handler={} />