mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### What problem does this PR solve? Feat: Deleting the last tool of the agent will delete the tool node #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -184,7 +184,7 @@ function useAddChildEdge() {
|
||||
return { addChildEdge };
|
||||
}
|
||||
|
||||
function useAddTooNode() {
|
||||
function useAddToolNode() {
|
||||
const addNode = useGraphStore((state) => state.addNode);
|
||||
const getNode = useGraphStore((state) => state.getNode);
|
||||
const addEdge = useGraphStore((state) => state.addEdge);
|
||||
@ -241,7 +241,7 @@ export function useAddNode(reactFlowInstance?: ReactFlowInstance<any, any>) {
|
||||
const initializeOperatorParams = useInitializeOperatorParams();
|
||||
const { calculateNewlyBackChildPosition } = useCalculateNewlyChildPosition();
|
||||
const { addChildEdge } = useAddChildEdge();
|
||||
const { addToolNode } = useAddTooNode();
|
||||
const { addToolNode } = useAddToolNode();
|
||||
// const [reactFlowInstance, setReactFlowInstance] =
|
||||
// useState<ReactFlowInstance<any, any>>();
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ export const useShowFormDrawer = () => {
|
||||
clickedNodeId: clickNodeId,
|
||||
setClickedNodeId,
|
||||
getNode,
|
||||
setClickedToolId,
|
||||
} = useGraphStore((state) => state);
|
||||
const {
|
||||
visible: formDrawerVisible,
|
||||
@ -21,12 +22,13 @@ export const useShowFormDrawer = () => {
|
||||
showModal: showFormDrawer,
|
||||
} = useSetModalState();
|
||||
|
||||
const handleShow = useCallback(
|
||||
(node: Node) => {
|
||||
const handleShow: NodeMouseHandler = useCallback(
|
||||
(e, node: Node) => {
|
||||
setClickedNodeId(node.id);
|
||||
setClickedToolId(get(e.target, 'dataset.tool'));
|
||||
showFormDrawer();
|
||||
},
|
||||
[showFormDrawer, setClickedNodeId],
|
||||
[setClickedNodeId, setClickedToolId, showFormDrawer],
|
||||
);
|
||||
|
||||
return {
|
||||
@ -118,7 +120,7 @@ export function useShowDrawer({
|
||||
if (!ExcludedNodes.some((x) => x === node.data.label)) {
|
||||
hideSingleDebugDrawer();
|
||||
hideRunOrChatDrawer();
|
||||
showFormDrawer(node);
|
||||
showFormDrawer(e, node);
|
||||
}
|
||||
// handle single debug icon click
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user