mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 00:46:52 +08:00
### What problem does this PR solve? Feat: Render agent details #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
18 lines
480 B
TypeScript
18 lines
480 B
TypeScript
import { IGraph } from '@/interfaces/database/flow';
|
|
import { useCallback } from 'react';
|
|
import useGraphStore from '../store';
|
|
|
|
export const useSetGraphInfo = () => {
|
|
const { setEdges, setNodes } = useGraphStore((state) => state);
|
|
const setGraphInfo = useCallback(
|
|
({ nodes = [], edges = [] }: IGraph) => {
|
|
if (nodes.length || edges.length) {
|
|
setNodes(nodes);
|
|
setEdges(edges);
|
|
}
|
|
},
|
|
[setEdges, setNodes],
|
|
);
|
|
return setGraphInfo;
|
|
};
|