diff --git a/src/workflows/NodeInspector.jsx b/src/workflows/NodeInspector.jsx new file mode 100644 index 0000000..22ec067 --- /dev/null +++ b/src/workflows/NodeInspector.jsx @@ -0,0 +1,65 @@ +import React from 'react' + +const CONDITION_OPERATIONS = ['equals', 'not_equals', 'exists', 'greater_than', 'less_than', 'contains', 'array_not_empty', 'score_at_least'] + +export default function NodeInspector({ node, tools, onChange, onDelete, readOnly }) { + const [configText, setConfigText] = React.useState('{}') + const [configError, setConfigError] = React.useState('') + + React.useEffect(() => { + setConfigText(JSON.stringify(node?.data?.config || {}, null, 2)) + setConfigError('') + }, [node]) + + if (!node) return
Select a node to edit it.
+ const nodeType = node.data.nodeType + const patchConfig = (config) => onChange({ ...node, data: { ...node.data, config, tool: config.tool || '' } }) + return ( +
+
+ {node.id} + {!readOnly && } +
+ + {nodeType === 'tool' && ( + + )} + {nodeType === 'condition' && ( + + )} +