add tools warning
This commit is contained in:
parent
cf6539cd3f
commit
5731858db1
|
|
@ -20,6 +20,7 @@ class ReadFile_Tools implements INode {
|
||||||
category: string
|
category: string
|
||||||
baseClasses: string[]
|
baseClasses: string[]
|
||||||
inputs: INodeParams[]
|
inputs: INodeParams[]
|
||||||
|
warning: string
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'Read File'
|
this.label = 'Read File'
|
||||||
|
|
@ -28,6 +29,7 @@ class ReadFile_Tools implements INode {
|
||||||
this.type = 'ReadFile'
|
this.type = 'ReadFile'
|
||||||
this.icon = 'readfile.svg'
|
this.icon = 'readfile.svg'
|
||||||
this.category = 'Tools'
|
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.description = 'Read file from disk'
|
||||||
this.baseClasses = [this.type, 'Tool', ...getBaseClasses(ReadFileTool)]
|
this.baseClasses = [this.type, 'Tool', ...getBaseClasses(ReadFileTool)]
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class WriteFile_Tools implements INode {
|
||||||
category: string
|
category: string
|
||||||
baseClasses: string[]
|
baseClasses: string[]
|
||||||
inputs: INodeParams[]
|
inputs: INodeParams[]
|
||||||
|
warning: string
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'Write File'
|
this.label = 'Write File'
|
||||||
|
|
@ -28,6 +29,7 @@ class WriteFile_Tools implements INode {
|
||||||
this.type = 'WriteFile'
|
this.type = 'WriteFile'
|
||||||
this.icon = 'writefile.svg'
|
this.icon = 'writefile.svg'
|
||||||
this.category = 'Tools'
|
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.description = 'Write file to disk'
|
||||||
this.baseClasses = [this.type, 'Tool', ...getBaseClasses(WriteFileTool)]
|
this.baseClasses = [this.type, 'Tool', ...getBaseClasses(WriteFileTool)]
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ export interface INodeProperties {
|
||||||
documentation?: string
|
documentation?: string
|
||||||
color?: string
|
color?: string
|
||||||
hint?: string
|
hint?: string
|
||||||
|
warning?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INode extends INodeProperties {
|
export interface INode extends INodeProperties {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,8 @@ const AgentFlowNode = ({ data }) => {
|
||||||
componentNode?.deprecateMessage ??
|
componentNode?.deprecateMessage ??
|
||||||
'This node will be deprecated in the next release. Change to a new node tagged with NEW'
|
'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 {
|
} else {
|
||||||
setWarningMessage('')
|
setWarningMessage('')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import PropTypes from 'prop-types'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
// Material
|
// 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 { useTheme } from '@mui/material/styles'
|
||||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
||||||
import { IconSettings } from '@tabler/icons-react'
|
import { IconSettings, IconAlertTriangle } from '@tabler/icons-react'
|
||||||
|
|
||||||
// Project imports
|
// Project imports
|
||||||
import NodeInputHandler from '../canvas/NodeInputHandler'
|
import NodeInputHandler from '../canvas/NodeInputHandler'
|
||||||
|
|
@ -292,8 +292,21 @@ export const ConfigInput = ({ data, inputParam, disabled = false, arrayIndex = n
|
||||||
>
|
>
|
||||||
<Accordion sx={{ background: 'transparent' }} expanded={expanded} onChange={handleAccordionChange}>
|
<Accordion sx={{ background: 'transparent' }} expanded={expanded} onChange={handleAccordionChange}>
|
||||||
<AccordionSummary expandIcon={<ExpandMoreIcon />} sx={{ background: 'transparent' }}>
|
<AccordionSummary expandIcon={<ExpandMoreIcon />} sx={{ background: 'transparent' }}>
|
||||||
<IconSettings stroke={1.5} size='1.3rem' />
|
<div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
|
||||||
<Typography sx={{ ml: 1 }}>{selectedComponentNodeData?.label} Parameters</Typography>
|
<IconSettings stroke={1.5} size='1.3rem' />
|
||||||
|
<Typography sx={{ ml: 1 }}>{selectedComponentNodeData?.label} Parameters</Typography>
|
||||||
|
<div style={{ flexGrow: 1 }}></div>
|
||||||
|
{selectedComponentNodeData?.warning && (
|
||||||
|
<Tooltip
|
||||||
|
title={<span style={{ whiteSpace: 'pre-line' }}>{selectedComponentNodeData.warning}</span>}
|
||||||
|
placement='top'
|
||||||
|
>
|
||||||
|
<IconButton sx={{ height: 35, width: 35 }}>
|
||||||
|
<IconAlertTriangle size={20} color='orange' />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</AccordionSummary>
|
</AccordionSummary>
|
||||||
<AccordionDetails>
|
<AccordionDetails>
|
||||||
{(selectedComponentNodeData.inputParams ?? [])
|
{(selectedComponentNodeData.inputParams ?? [])
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@ const CanvasNode = ({ data }) => {
|
||||||
componentNode?.deprecateMessage ??
|
componentNode?.deprecateMessage ??
|
||||||
'This node will be deprecated in the next release. Change to a new node tagged with NEW'
|
'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 {
|
} else {
|
||||||
setWarningMessage('')
|
setWarningMessage('')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue