mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-27 13:57:46 +00:00
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: 谨欣 <echo.cmy@antgroup.com> Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com> Co-authored-by: yanzhiyong <932374019@qq.com>
25 lines
664 B
TypeScript
25 lines
664 B
TypeScript
import { IFlowData } from '@/types/flow';
|
|
import { mapUnderlineToHump } from '@/utils/flow';
|
|
import React from 'react';
|
|
import ReactFlow, { Background } from 'reactflow';
|
|
import 'reactflow/dist/style.css';
|
|
import ButtonEdge from './button-edge';
|
|
|
|
const PreviewFlow: React.FC<{ flowData: IFlowData; minZoom?: number }> = ({ flowData, minZoom }) => {
|
|
const data = mapUnderlineToHump(flowData);
|
|
|
|
return (
|
|
<ReactFlow
|
|
nodes={data.nodes}
|
|
edges={data.edges}
|
|
edgeTypes={{ buttonedge: ButtonEdge }}
|
|
fitView
|
|
minZoom={minZoom || 0.1}
|
|
>
|
|
<Background color='#aaa' gap={16} />
|
|
</ReactFlow>
|
|
);
|
|
};
|
|
|
|
export default PreviewFlow;
|