From 5731858db13b22d8ff03c7e5bb65e04151ecebf0 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 23 Sep 2025 15:51:46 +0100 Subject: [PATCH] add tools warning --- .../nodes/tools/ReadFile/ReadFile.ts | 2 ++ .../nodes/tools/WriteFile/WriteFile.ts | 2 ++ packages/components/src/Interface.ts | 1 + .../src/views/agentflowsv2/AgentFlowNode.jsx | 2 ++ .../ui/src/views/agentflowsv2/ConfigInput.jsx | 21 +++++++++++++++---- packages/ui/src/views/canvas/CanvasNode.jsx | 2 ++ 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/packages/components/nodes/tools/ReadFile/ReadFile.ts b/packages/components/nodes/tools/ReadFile/ReadFile.ts index 6fa4f72ac..3f76bf649 100644 --- a/packages/components/nodes/tools/ReadFile/ReadFile.ts +++ b/packages/components/nodes/tools/ReadFile/ReadFile.ts @@ -20,6 +20,7 @@ class ReadFile_Tools implements INode { category: string baseClasses: string[] inputs: INodeParams[] + warning: string constructor() { this.label = 'Read File' @@ -28,6 +29,7 @@ class ReadFile_Tools implements INode { this.type = 'ReadFile' this.icon = 'readfile.svg' this.category = 'Tools' + this.warning = 'This tool can be used to read files from the disk. It is recommended to use this tool with caution.' this.description = 'Read file from disk' this.baseClasses = [this.type, 'Tool', ...getBaseClasses(ReadFileTool)] this.inputs = [ diff --git a/packages/components/nodes/tools/WriteFile/WriteFile.ts b/packages/components/nodes/tools/WriteFile/WriteFile.ts index bcb372f86..b4fe8ceaf 100644 --- a/packages/components/nodes/tools/WriteFile/WriteFile.ts +++ b/packages/components/nodes/tools/WriteFile/WriteFile.ts @@ -20,6 +20,7 @@ class WriteFile_Tools implements INode { category: string baseClasses: string[] inputs: INodeParams[] + warning: string constructor() { this.label = 'Write File' @@ -28,6 +29,7 @@ class WriteFile_Tools implements INode { this.type = 'WriteFile' this.icon = 'writefile.svg' this.category = 'Tools' + this.warning = 'This tool can be used to write files to the disk. It is recommended to use this tool with caution.' this.description = 'Write file to disk' this.baseClasses = [this.type, 'Tool', ...getBaseClasses(WriteFileTool)] this.inputs = [ diff --git a/packages/components/src/Interface.ts b/packages/components/src/Interface.ts index 5e2ee383c..7a170eaa0 100644 --- a/packages/components/src/Interface.ts +++ b/packages/components/src/Interface.ts @@ -134,6 +134,7 @@ export interface INodeProperties { documentation?: string color?: string hint?: string + warning?: string } export interface INode extends INodeProperties { diff --git a/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx b/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx index 7941d69b9..8bfafd9b2 100644 --- a/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx +++ b/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx @@ -179,6 +179,8 @@ const AgentFlowNode = ({ data }) => { componentNode?.deprecateMessage ?? 'This node will be deprecated in the next release. Change to a new node tagged with NEW' ) + } else if (componentNode.warning) { + setWarningMessage(componentNode.warning) } else { setWarningMessage('') } diff --git a/packages/ui/src/views/agentflowsv2/ConfigInput.jsx b/packages/ui/src/views/agentflowsv2/ConfigInput.jsx index 94b022356..6ce7aac91 100644 --- a/packages/ui/src/views/agentflowsv2/ConfigInput.jsx +++ b/packages/ui/src/views/agentflowsv2/ConfigInput.jsx @@ -3,10 +3,10 @@ import PropTypes from 'prop-types' import { cloneDeep } from 'lodash' // Material -import { Accordion, AccordionSummary, AccordionDetails, Box, Typography } from '@mui/material' +import { Accordion, AccordionSummary, AccordionDetails, Box, Typography, Tooltip, IconButton } from '@mui/material' import { useTheme } from '@mui/material/styles' import ExpandMoreIcon from '@mui/icons-material/ExpandMore' -import { IconSettings } from '@tabler/icons-react' +import { IconSettings, IconAlertTriangle } from '@tabler/icons-react' // Project imports import NodeInputHandler from '../canvas/NodeInputHandler' @@ -292,8 +292,21 @@ export const ConfigInput = ({ data, inputParam, disabled = false, arrayIndex = n > } sx={{ background: 'transparent' }}> - - {selectedComponentNodeData?.label} Parameters +
+ + {selectedComponentNodeData?.label} Parameters +
+ {selectedComponentNodeData?.warning && ( + {selectedComponentNodeData.warning}} + placement='top' + > + + + + + )} +
{(selectedComponentNodeData.inputParams ?? []) diff --git a/packages/ui/src/views/canvas/CanvasNode.jsx b/packages/ui/src/views/canvas/CanvasNode.jsx index 471b4d079..03d9e51ee 100644 --- a/packages/ui/src/views/canvas/CanvasNode.jsx +++ b/packages/ui/src/views/canvas/CanvasNode.jsx @@ -82,6 +82,8 @@ const CanvasNode = ({ data }) => { componentNode?.deprecateMessage ?? 'This node will be deprecated in the next release. Change to a new node tagged with NEW' ) + } else if (componentNode.warning) { + setWarningMessage(componentNode.warning) } else { setWarningMessage('') }