Commit 331b851a by heheer Committed by GitHub

fix has tool node condition (#4907)

parent 50d235c4
...@@ -19,7 +19,7 @@ export const useNodeTemplates = () => { ...@@ -19,7 +19,7 @@ export const useNodeTemplates = () => {
const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList); const nodeList = useContextSelector(WorkflowContext, (v) => v.nodeList);
const hasToolNode = useMemo( const hasToolNode = useMemo(
() => nodeList.some((node) => node.flowNodeType === FlowNodeTypeEnum.toolSet), () => nodeList.some((node) => node.flowNodeType === FlowNodeTypeEnum.tools),
[nodeList] [nodeList]
); );
......
...@@ -105,7 +105,6 @@ type WorkflowContextType = { ...@@ -105,7 +105,6 @@ type WorkflowContextType = {
// nodes // nodes
nodeList: FlowNodeItemType[]; nodeList: FlowNodeItemType[];
hasToolNode: boolean;
onUpdateNodeError: (node: string, isError: Boolean) => void; onUpdateNodeError: (node: string, isError: Boolean) => void;
onResetNode: (e: { id: string; node: FlowNodeTemplateType }) => void; onResetNode: (e: { id: string; node: FlowNodeTemplateType }) => void;
...@@ -226,7 +225,6 @@ export const WorkflowContext = createContext<WorkflowContextType>({ ...@@ -226,7 +225,6 @@ export const WorkflowContext = createContext<WorkflowContextType>({
}, },
basicNodeTemplates: [], basicNodeTemplates: [],
nodeList: [], nodeList: [],
hasToolNode: false,
onUpdateNodeError: function (node: string, isError: Boolean): void { onUpdateNodeError: function (node: string, isError: Boolean): void {
throw new Error('Function not implemented.'); throw new Error('Function not implemented.');
}, },
...@@ -399,10 +397,6 @@ const WorkflowContextProvider = ({ ...@@ -399,10 +397,6 @@ const WorkflowContextProvider = ({
[nodeListString] [nodeListString]
); );
const hasToolNode = useMemo(() => {
return !!nodeList.find((node) => node.flowNodeType === FlowNodeTypeEnum.tools);
}, [nodeList]);
const onUpdateNodeError = useMemoizedFn((nodeId: string, isError: Boolean) => { const onUpdateNodeError = useMemoizedFn((nodeId: string, isError: Boolean) => {
setNodes((state) => { setNodes((state) => {
return state.map((item) => { return state.map((item) => {
...@@ -1011,7 +1005,6 @@ const WorkflowContextProvider = ({ ...@@ -1011,7 +1005,6 @@ const WorkflowContextProvider = ({
// node // node
nodeList, nodeList,
hasToolNode,
onUpdateNodeError, onUpdateNodeError,
onResetNode, onResetNode,
onChangeNode, onChangeNode,
...@@ -1057,7 +1050,6 @@ const WorkflowContextProvider = ({ ...@@ -1057,7 +1050,6 @@ const WorkflowContextProvider = ({
flowData2StoreDataAndCheck, flowData2StoreDataAndCheck,
future, future,
getNodeDynamicInputs, getNodeDynamicInputs,
hasToolNode,
initData, initData,
nodeList, nodeList,
onChangeNode, onChangeNode,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment