From d5c8d16e642d8797f8ff00605a30dbd57a6cb0f5 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 15 Apr 2026 16:27:45 +0800 Subject: [PATCH] fix(web): tool methods add cache --- web/src/views/Workflow/components/CheckList/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/views/Workflow/components/CheckList/index.tsx b/web/src/views/Workflow/components/CheckList/index.tsx index 0256416a..62132a71 100644 --- a/web/src/views/Workflow/components/CheckList/index.tsx +++ b/web/src/views/Workflow/components/CheckList/index.tsx @@ -118,6 +118,7 @@ const CheckList: FC = ({ workflowRef, appId }) => { const { setCheckResults, getCheckResults } = useWorkflowStore() const results = getCheckResults(appId) const timerRef = useRef>() + const toolMethodsCacheRef = useRef }>>>({}) const runCheck = useCallback(async () => { const graph = workflowRef.current?.graphRef?.current @@ -167,7 +168,10 @@ const CheckList: FC = ({ workflowRef, appId }) => { if (typeof toolId === 'string') { try { - const methods = await getToolMethods(toolId) as Array<{ name: string; parameters: Array<{ name: string; required: boolean }> }> + if (!toolMethodsCacheRef.current[toolId]) { + toolMethodsCacheRef.current[toolId] = await getToolMethods(toolId) as Array<{ name: string; parameters: Array<{ name: string; required: boolean }> }> + } + const methods = toolMethodsCacheRef.current[toolId] const operation = toolParameters?.operation const method = operation ? methods.find(m => m.name === operation) : methods[0] if (method) {