mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
This reverts commit ba1451a0e9
.
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
"axios": "^1.3.3",
|
"axios": "^1.3.3",
|
||||||
"cookie": "^0.5.0",
|
"cookie": "^0.5.0",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"dagre": "^0.8.5",
|
|
||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"downloadjs": "^1.4.7",
|
"downloadjs": "^1.4.7",
|
||||||
|
2688
client/pnpm-lock.yaml
generated
2688
client/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,10 @@ import ReactFlow, {
|
|||||||
useEdgesState,
|
useEdgesState,
|
||||||
XYPosition,
|
XYPosition,
|
||||||
Connection,
|
Connection,
|
||||||
useViewport,
|
useViewport
|
||||||
useReactFlow
|
|
||||||
} from 'reactflow';
|
} from 'reactflow';
|
||||||
import { Box, Flex, IconButton, useTheme, useDisclosure, Icon } from '@chakra-ui/react';
|
import { Box, Flex, IconButton, useTheme, useDisclosure } from '@chakra-ui/react';
|
||||||
import { RepeatIcon, SmallCloseIcon } from '@chakra-ui/icons';
|
import { SmallCloseIcon } from '@chakra-ui/icons';
|
||||||
import {
|
import {
|
||||||
edgeOptions,
|
edgeOptions,
|
||||||
connectionLineStyle,
|
connectionLineStyle,
|
||||||
@@ -36,7 +35,6 @@ import { useToast } from '@/hooks/useToast';
|
|||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useCopyData } from '@/utils/tools';
|
import { useCopyData } from '@/utils/tools';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import dagre from 'dagre';
|
|
||||||
|
|
||||||
import MyIcon from '@/components/Icon';
|
import MyIcon from '@/components/Icon';
|
||||||
import ButtonEdge from './components/modules/ButtonEdge';
|
import ButtonEdge from './components/modules/ButtonEdge';
|
||||||
@@ -447,8 +445,6 @@ const AppEdit = ({ app, onCloseSettings }: Props) => {
|
|||||||
initData(JSON.parse(JSON.stringify(app.modules)));
|
initData(JSON.parse(JSON.stringify(app.modules)));
|
||||||
}, [app.modules]);
|
}, [app.modules]);
|
||||||
|
|
||||||
const reactFlowInstance = useReactFlow();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* header */}
|
{/* header */}
|
||||||
@@ -591,51 +587,7 @@ const AppEdit = ({ app, onCloseSettings }: Props) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Background />
|
<Background />
|
||||||
<Controls position={'bottom-right'} style={{ display: 'flex' }} showInteractive={false}>
|
<Controls position={'bottom-right'} style={{ display: 'flex' }} showInteractive={false} />
|
||||||
<button
|
|
||||||
className="react-flow__controls-button react-flow__controls-fitview"
|
|
||||||
onClick={() => {
|
|
||||||
var g = new dagre.graphlib.Graph();
|
|
||||||
g.setGraph({
|
|
||||||
rankdir: 'LR',
|
|
||||||
align: 'DL',
|
|
||||||
graph: 'greedy',
|
|
||||||
ranksep: 200,
|
|
||||||
ranker: 'longest-path',
|
|
||||||
nodesep: 300,
|
|
||||||
edgesep: 100
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function () {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
reactFlowInstance.getNodes().forEach((node) => {
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
});
|
|
||||||
reactFlowInstance.getEdges().forEach((edge) => {
|
|
||||||
g.setEdge(edge.source, edge.target);
|
|
||||||
});
|
|
||||||
const p = dagre.layout(g);
|
|
||||||
const newNodes = g.nodes().map(function (v) {
|
|
||||||
const node = g.node(v);
|
|
||||||
return {
|
|
||||||
...node,
|
|
||||||
position: {
|
|
||||||
x: node.x,
|
|
||||||
y: node.y
|
|
||||||
},
|
|
||||||
x: undefined,
|
|
||||||
y: undefined
|
|
||||||
};
|
|
||||||
});
|
|
||||||
reactFlowInstance.setNodes(newNodes);
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
reactFlowInstance.fitView();
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon as={RepeatIcon} />
|
|
||||||
</button>
|
|
||||||
</Controls>
|
|
||||||
</ReactFlow>
|
</ReactFlow>
|
||||||
|
|
||||||
<TemplateList
|
<TemplateList
|
||||||
|
Reference in New Issue
Block a user