fix has tool node condition (#4907)

This commit is contained in:
heheer 2025-05-28 10:34:02 +08:00 committed by GitHub
parent 50d235c42a
commit 331b851a78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 9 deletions

View File

@ -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]
); );

View File

@ -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>({
}, },
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 = ({
[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 = ({
// node // node
nodeList, nodeList,
hasToolNode,
onUpdateNodeError, onUpdateNodeError,
onResetNode, onResetNode,
onChangeNode, onChangeNode,
@ -1057,7 +1050,6 @@ const WorkflowContextProvider = ({
flowData2StoreDataAndCheck, flowData2StoreDataAndCheck,
future, future,
getNodeDynamicInputs, getNodeDynamicInputs,
hasToolNode,
initData, initData,
nodeList, nodeList,
onChangeNode, onChangeNode,