mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-02 08:35:08 +08:00
### What problem does this PR solve? Feat: Add agent operator node from agent form #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -6,6 +6,7 @@ import {
|
||||
} from '@xyflow/react';
|
||||
import '@xyflow/react/dist/style.css';
|
||||
import { ChatSheet } from '../chat/chat-sheet';
|
||||
import { AgentInstanceContext } from '../context';
|
||||
import FormSheet from '../form-sheet/next';
|
||||
import {
|
||||
useHandleDrop,
|
||||
@ -13,6 +14,7 @@ import {
|
||||
useValidateConnection,
|
||||
useWatchNodeFormDataChange,
|
||||
} from '../hooks';
|
||||
import { useAddNode } from '../hooks/use-add-node';
|
||||
import { useBeforeDelete } from '../hooks/use-before-delete';
|
||||
import { useShowDrawer } from '../hooks/use-show-drawer';
|
||||
import RunSheet from '../run-sheet';
|
||||
@ -77,7 +79,8 @@ function AgentCanvas({ drawerVisible, hideDrawer }: IProps) {
|
||||
} = useSelectCanvasData();
|
||||
const isValidConnection = useValidateConnection();
|
||||
|
||||
const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();
|
||||
const { onDrop, onDragOver, setReactFlowInstance, reactFlowInstance } =
|
||||
useHandleDrop();
|
||||
|
||||
const {
|
||||
onNodeClick,
|
||||
@ -101,6 +104,8 @@ function AgentCanvas({ drawerVisible, hideDrawer }: IProps) {
|
||||
|
||||
useWatchNodeFormDataChange();
|
||||
|
||||
const { addCanvasNode } = useAddNode(reactFlowInstance);
|
||||
|
||||
return (
|
||||
<div className={styles.canvasWrapper}>
|
||||
<svg
|
||||
@ -156,14 +161,16 @@ function AgentCanvas({ drawerVisible, hideDrawer }: IProps) {
|
||||
<Background />
|
||||
</ReactFlow>
|
||||
{formDrawerVisible && (
|
||||
<FormSheet
|
||||
node={clickedNode}
|
||||
visible={formDrawerVisible}
|
||||
hideModal={hideFormDrawer}
|
||||
singleDebugDrawerVisible={singleDebugDrawerVisible}
|
||||
hideSingleDebugDrawer={hideSingleDebugDrawer}
|
||||
showSingleDebugDrawer={showSingleDebugDrawer}
|
||||
></FormSheet>
|
||||
<AgentInstanceContext.Provider value={{ addCanvasNode }}>
|
||||
<FormSheet
|
||||
node={clickedNode}
|
||||
visible={formDrawerVisible}
|
||||
hideModal={hideFormDrawer}
|
||||
singleDebugDrawerVisible={singleDebugDrawerVisible}
|
||||
hideSingleDebugDrawer={hideSingleDebugDrawer}
|
||||
showSingleDebugDrawer={showSingleDebugDrawer}
|
||||
></FormSheet>
|
||||
</AgentInstanceContext.Provider>
|
||||
)}
|
||||
{chatVisible && (
|
||||
<ChatSheet
|
||||
|
||||
Reference in New Issue
Block a user