diff --git a/packages/components/nodes/tools/CustomTool/core.ts b/packages/components/nodes/tools/CustomTool/core.ts index b7b1f6a6..8bae726c 100644 --- a/packages/components/nodes/tools/CustomTool/core.ts +++ b/packages/components/nodes/tools/CustomTool/core.ts @@ -2,7 +2,6 @@ import { z } from 'zod' import { CallbackManagerForToolRun } from 'langchain/callbacks' import { StructuredTool, ToolParams } from 'langchain/tools' import { NodeVM } from 'vm2' -import { logger } from "@zilliz/milvus2-sdk-node"; /* * List of dependencies allowed to be import in vm2 diff --git a/packages/ui/src/views/variables/AddEditVariableDialog.js b/packages/ui/src/views/variables/AddEditVariableDialog.js index db2116b0..85c40e44 100644 --- a/packages/ui/src/views/variables/AddEditVariableDialog.js +++ b/packages/ui/src/views/variables/AddEditVariableDialog.js @@ -26,6 +26,7 @@ import useNotifier from 'utils/useNotifier' import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions' import { TooltipWithParser } from '../../ui-component/tooltip/TooltipWithParser' import { Dropdown } from '../../ui-component/dropdown/Dropdown' +import { SwitchInput } from '../../ui-component/switch/Switch' const variableTypes = [ { @@ -50,29 +51,29 @@ const AddEditVariableDialog = ({ show, dialogProps, onCancel, onConfirm }) => { const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) - const [name, setName] = useState('') - const [value, setValue] = useState('') - const [type, setType] = useState('') + const [variableName, setVariableName] = useState('') + const [variableValue, setVariableValue] = useState('') + const [variableType, setVariableType] = useState('static') + const [dialogType, setDialogType] = useState('ADD') const [variable, setVariable] = useState({}) useEffect(() => { - if (dialogProps.type === 'EDIT' && dialogProps.data) { + if (dialogProps.type === 'EDIT') { // When variable dialog is opened from Variables dashboard - setName(dialogProps.data.name) - setValue(dialogProps.data.value) - setType(dialogProps.data.type) + setVariableName(dialogProps.data.name) + setVariableValue(dialogProps.data.value) + setVariableType(dialogProps.data.type) setVariable(dialogProps.data) - } else if (dialogProps.type === 'ADD' && dialogProps.data) { + setDialogType('EDIT') + } else if (dialogProps.type === 'ADD') { // When variable dialog is to add a new variable - setName('') - setValue('') - setType('static') - setVariable({ name: '', value: '', type: 'static' }) + setVariableName('') + setVariableValue('') + setVariableType('static') + setDialogType('ADD') } - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [dialogProps]) + }, [dialogProps.data, dialogProps.type]) useEffect(() => { if (show) dispatch({ type: SHOW_CANVAS_DIALOG }) @@ -83,9 +84,9 @@ const AddEditVariableDialog = ({ show, dialogProps, onCancel, onConfirm }) => { const addNewVariable = async () => { try { const obj = { - name: name, - value: value, - type: type + name: variableName, + value: variableValue, + type: variableType } const createResp = await variablesApi.createVariable(obj) if (createResp.data) { @@ -125,9 +126,9 @@ const AddEditVariableDialog = ({ show, dialogProps, onCancel, onConfirm }) => { const saveVariable = async () => { try { const saveObj = { - name: name, - value: value, - type: type + name: variableName, + value: variableValue, + type: variableType } const saveResp = await variablesApi.updateVariable(variable.id, saveObj) @@ -207,7 +208,13 @@ const AddEditVariableDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
-