Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): replace straightforward explicit any types (#44228)

Stephen Zhou2625ebec766b
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index af258a93719..5f7c6f67567 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -57,11 +57,6 @@
"count": 3
}
},
- "web/app/(shareLayout)/webapp-reset-password/layout.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/(shareLayout)/webapp-signin/normalForm.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 2
@@ -229,11 +224,6 @@
"count": 1
}
},
- "web/app/components/app/configuration/config-var/config-modal/index.tsx": {
- "typescript/no-explicit-any": {
- "count": 4
- }
- },
"web/app/components/app/configuration/config-var/index.tsx": {
"dify/require-disable-directive-description": {
"count": 1
@@ -274,7 +264,7 @@
"count": 2
},
"typescript/no-explicit-any": {
- "count": 7
+ "count": 5
}
},
"web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx": {
@@ -360,7 +350,7 @@
},
"web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx": {
"typescript/no-explicit-any": {
- "count": 6
+ "count": 5
}
},
"web/app/components/app/configuration/debug/debug-with-multiple-model/index.tsx": {
@@ -380,7 +370,7 @@
},
"web/app/components/app/configuration/debug/debug-with-single-model/index.tsx": {
"typescript/no-explicit-any": {
- "count": 5
+ "count": 4
}
},
"web/app/components/app/configuration/debug/hooks.tsx": {
@@ -393,7 +383,7 @@
"count": 1
},
"typescript/no-explicit-any": {
- "count": 4
+ "count": 3
}
},
"web/app/components/app/configuration/debug/types.ts": {
@@ -543,11 +533,6 @@
"count": 1
}
},
- "web/app/components/base/agent-log-modal/result.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/base/agent-log-modal/tool-call.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -593,9 +578,6 @@
"web/app/components/base/auto-height-textarea/index.stories.tsx": {
"no-console": {
"count": 2
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/app/components/base/auto-height-textarea/index.tsx": {
@@ -621,7 +603,7 @@
},
"web/app/components/base/chat/chat-with-history/context.ts": {
"typescript/no-explicit-any": {
- "count": 7
+ "count": 6
}
},
"web/app/components/base/chat/chat-with-history/header-in-mobile.tsx": {
@@ -636,7 +618,7 @@
},
"web/app/components/base/chat/chat-with-history/hooks.tsx": {
"typescript/no-explicit-any": {
- "count": 18
+ "count": 17
}
},
"web/app/components/base/chat/chat-with-history/index.tsx": {
@@ -696,7 +678,7 @@
"count": 2
},
"typescript/no-explicit-any": {
- "count": 10
+ "count": 9
}
},
"web/app/components/base/chat/chat/question.tsx": {
@@ -706,7 +688,7 @@
},
"web/app/components/base/chat/chat/type.ts": {
"typescript/no-explicit-any": {
- "count": 4
+ "count": 3
}
},
"web/app/components/base/chat/chat/utils.ts": {
@@ -721,7 +703,7 @@
},
"web/app/components/base/chat/embedded-chatbot/context.ts": {
"typescript/no-explicit-any": {
- "count": 7
+ "count": 6
}
},
"web/app/components/base/chat/embedded-chatbot/hooks.tsx": {
@@ -757,15 +739,12 @@
},
"web/app/components/base/chat/utils.ts": {
"typescript/no-explicit-any": {
- "count": 10
+ "count": 2
}
},
"web/app/components/base/error-boundary/index.tsx": {
"react/only-export-components": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 2
}
},
"web/app/components/base/features/context.tsx": {
@@ -863,7 +842,7 @@
"count": 1
},
"typescript/no-explicit-any": {
- "count": 2
+ "count": 1
}
},
"web/app/components/base/form/components/base/base-form.tsx": {
@@ -886,11 +865,6 @@
"count": 2
}
},
- "web/app/components/base/form/form-scenarios/base/field.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/base/form/form-scenarios/base/types.ts": {
"typescript/no-explicit-any": {
"count": 1
@@ -901,11 +875,6 @@
"count": 2
}
},
- "web/app/components/base/form/form-scenarios/input-field/field.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/base/form/form-scenarios/input-field/types.ts": {
"typescript/no-explicit-any": {
"count": 2
@@ -918,12 +887,7 @@
},
"web/app/components/base/form/hooks/use-check-validated.ts": {
"typescript/no-explicit-any": {
- "count": 2
- }
- },
- "web/app/components/base/form/hooks/use-get-validators.ts": {
- "typescript/no-explicit-any": {
- "count": 3
+ "count": 1
}
},
"web/app/components/base/form/types.ts": {
@@ -931,11 +895,6 @@
"count": 15
}
},
- "web/app/components/base/form/utils/secret-input/index.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/base/image-uploader/__tests__/utils.spec.ts": {
"no-restricted-imports": {
"count": 1
@@ -944,11 +903,6 @@
"count": 3
}
},
- "web/app/components/base/image-uploader/hooks.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/base/image-uploader/image-preview.tsx": {
"jsx-a11y/no-static-element-interactions": {
"count": 1
@@ -957,9 +911,6 @@
"web/app/components/base/image-uploader/utils.ts": {
"no-restricted-imports": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/app/components/base/markdown-blocks/__tests__/paragraph.spec.tsx": {
@@ -974,7 +925,7 @@
},
"web/app/components/base/markdown-blocks/code-block.tsx": {
"typescript/no-explicit-any": {
- "count": 9
+ "count": 2
}
},
"web/app/components/base/markdown-blocks/index.ts": {
@@ -1017,14 +968,6 @@
"count": 1
}
},
- "web/app/components/base/markdown/error-boundary.tsx": {
- "dify/require-disable-directive-description": {
- "count": 2
- },
- "typescript/no-explicit-any": {
- "count": 3
- }
- },
"web/app/components/base/mermaid/index.tsx": {
"eslint-react/set-state-in-effect": {
"count": 4
@@ -1040,14 +983,11 @@
},
"regexp/no-super-linear-backtracking": {
"count": 3
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/app/components/base/mermaid/utils.ts": {
"typescript/no-explicit-any": {
- "count": 4
+ "count": 2
}
},
"web/app/components/base/message-log-modal/index.stories.tsx": {
@@ -1055,11 +995,6 @@
"count": 1
}
},
- "web/app/components/base/new-audio-button/index.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/base/node-status/index.tsx": {
"react/only-export-components": {
"count": 1
@@ -1089,9 +1024,6 @@
},
"no-console": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 2
}
},
"web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx": {
@@ -1139,11 +1071,6 @@
"count": 2
}
},
- "web/app/components/base/prompt-editor/plugins/draggable-plugin/index.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/base/prompt-editor/plugins/error-message-block/component.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -1244,11 +1171,6 @@
"count": 3
}
},
- "web/app/components/base/prompt-editor/plugins/workflow-variable-block/node.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/base/prompt-log-modal/index.stories.tsx": {
"no-console": {
"count": 1
@@ -1265,9 +1187,6 @@
},
"no-console": {
"count": 2
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/app/components/base/text-generation/__tests__/hooks.spec.ts": {
@@ -1278,9 +1197,6 @@
"web/app/components/base/text-generation/hooks.ts": {
"no-restricted-imports": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/app/components/base/text-generation/types.ts": {
@@ -1331,11 +1247,6 @@
"count": 2
}
},
- "web/app/components/datasets/common/image-uploader/hooks/use-upload.ts": {
- "typescript/no-explicit-any": {
- "count": 3
- }
- },
"web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-input.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -1541,21 +1452,11 @@
"count": 1
}
},
- "web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/datasets/documents/create-from-pipeline/data-source/store/provider.tsx": {
"react/only-export-components": {
"count": 1
}
},
- "web/app/components/datasets/documents/create-from-pipeline/data-source/store/slices/online-drive.ts": {
- "typescript/no-explicit-any": {
- "count": 4
- }
- },
"web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx": {
"jsx-a11y/label-has-associated-control": {
"count": 2
@@ -1660,11 +1561,6 @@
"count": 2
}
},
- "web/app/components/datasets/documents/detail/context.ts": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/datasets/documents/detail/embedding/components/index.ts": {
"no-barrel-files/no-barrel-files": {
"count": 4
@@ -1936,11 +1832,6 @@
"count": 2
}
},
- "web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/plugins/marketplace/home/home-trending.tsx": {
"jsx-a11y/no-static-element-interactions": {
"count": 1
@@ -2053,11 +1944,6 @@
"count": 1
}
},
- "web/app/components/plugins/plugin-page/context.ts": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -2068,7 +1954,7 @@
},
"web/app/components/plugins/types.ts": {
"typescript/no-explicit-any": {
- "count": 20
+ "count": 8
}
},
"web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/hidden-fields.spec.tsx": {
@@ -2127,17 +2013,9 @@
"count": 2
}
},
- "web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx": {
"eslint-react/static-components": {
"count": 2
- },
- "typescript/no-explicit-any": {
- "count": 2
}
},
"web/app/components/rag-pipeline/components/panel/test-run/preparation/index.tsx": {
@@ -2165,11 +2043,6 @@
"count": 1
}
},
- "web/app/components/rag-pipeline/hooks/use-input-fields.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/rag-pipeline/hooks/use-nodes-sync-draft.ts": {
"no-restricted-imports": {
"count": 1
@@ -2454,11 +2327,6 @@
"count": 2
}
},
- "web/app/components/workflow/hooks/use-serial-async-callback.ts": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts": {
"typescript/no-explicit-any": {
"count": 1
@@ -2536,7 +2404,7 @@
"count": 1
},
"typescript/no-explicit-any": {
- "count": 6
+ "count": 1
}
},
"web/app/components/workflow/nodes/_base/components/entry-node-container.tsx": {
@@ -2616,11 +2484,6 @@
}
},
"web/app/components/workflow/nodes/_base/components/prompt/editor.tsx": {
- "typescript/no-explicit-any": {
- "count": 4
- }
- },
- "web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx": {
"typescript/no-explicit-any": {
"count": 1
}
@@ -2636,11 +2499,6 @@
"count": 1
}
},
- "web/app/components/workflow/nodes/_base/components/setting-item.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -2657,11 +2515,6 @@
"count": 2
}
},
- "web/app/components/workflow/nodes/_base/components/variable/match-schema-type.ts": {
- "typescript/no-explicit-any": {
- "count": 8
- }
- },
"web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/field.tsx": {
"jsx-a11y/no-static-element-interactions": {
"count": 1
@@ -2674,7 +2527,7 @@
},
"web/app/components/workflow/nodes/_base/components/variable/utils.ts": {
"typescript/no-explicit-any": {
- "count": 29
+ "count": 27
}
},
"web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx": {
@@ -2802,11 +2655,6 @@
"count": 1
}
},
- "web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 3
- }
- },
"web/app/components/workflow/nodes/assigner/utils.ts": {
"typescript/no-explicit-any": {
"count": 1
@@ -2820,11 +2668,6 @@
"count": 6
}
},
- "web/app/components/workflow/nodes/code/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 5
- }
- },
"web/app/components/workflow/nodes/data-source-empty/hooks.ts": {
"typescript/no-explicit-any": {
"count": 1
@@ -2850,16 +2693,6 @@
"count": 4
}
},
- "web/app/components/workflow/nodes/end/node.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
- "web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -2879,11 +2712,6 @@
"count": 1
}
},
- "web/app/components/workflow/nodes/http/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 5
- }
- },
"web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx": {
"jsx-a11y/click-events-have-key-events": {
"count": 2
@@ -2947,9 +2775,6 @@
"web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts": {
"dify/require-disable-directive-description": {
"count": 3
- },
- "typescript/no-explicit-any": {
- "count": 5
}
},
"web/app/components/workflow/nodes/iteration/node.tsx": {
@@ -2958,11 +2783,6 @@
}
},
"web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 6
- }
- },
- "web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts": {
"typescript/no-explicit-any": {
"count": 1
}
@@ -3090,12 +2910,7 @@
},
"web/app/components/workflow/nodes/llm/utils.ts": {
"typescript/no-explicit-any": {
- "count": 7
- }
- },
- "web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
+ "count": 5
}
},
"web/app/components/workflow/nodes/loop/components/condition-list/condition-item.tsx": {
@@ -3116,12 +2931,7 @@
},
"web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx": {
"typescript/no-explicit-any": {
- "count": 2
- }
- },
- "web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx": {
- "typescript/no-explicit-any": {
- "count": 4
+ "count": 1
}
},
"web/app/components/workflow/nodes/loop/panel.tsx": {
@@ -3142,11 +2952,6 @@
"count": 2
}
},
- "web/app/components/workflow/nodes/loop/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 3
- }
- },
"web/app/components/workflow/nodes/parameter-extractor/use-config.ts": {
"eslint-react/set-state-in-effect": {
"count": 2
@@ -3157,7 +2962,7 @@
},
"web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts": {
"typescript/no-explicit-any": {
- "count": 9
+ "count": 6
}
},
"web/app/components/workflow/nodes/question-classifier/__tests__/integration.spec.tsx": {
@@ -3167,7 +2972,7 @@
},
"web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts": {
"typescript/no-explicit-any": {
- "count": 8
+ "count": 6
}
},
"web/app/components/workflow/nodes/start/panel.tsx": {
@@ -3175,26 +2980,11 @@
"count": 2
}
},
- "web/app/components/workflow/nodes/start/use-config.ts": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/components/workflow/nodes/start/use-single-run-form-params.ts": {
"typescript/no-explicit-any": {
"count": 3
}
},
- "web/app/components/workflow/nodes/template-transform/use-config.ts": {
- "typescript/no-explicit-any": {
- "count": 4
- }
- },
- "web/app/components/workflow/nodes/template-transform/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 5
- }
- },
"web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx": {
"typescript/no-explicit-any": {
"count": 1
@@ -3218,12 +3008,12 @@
},
"web/app/components/workflow/nodes/tool/default.ts": {
"typescript/no-explicit-any": {
- "count": 6
+ "count": 5
}
},
"web/app/components/workflow/nodes/tool/hooks/use-config.ts": {
"typescript/no-explicit-any": {
- "count": 6
+ "count": 4
}
},
"web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts": {
@@ -3256,11 +3046,6 @@
"count": 10
}
},
- "web/app/components/workflow/nodes/trigger-plugin/node.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/workflow/nodes/trigger-plugin/panel.tsx": {
"typescript/no-explicit-any": {
"count": 3
@@ -3289,9 +3074,6 @@
"web/app/components/workflow/nodes/trigger-schedule/default.ts": {
"dify/require-disable-directive-description": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 4
}
},
"web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx": {
@@ -3328,11 +3110,6 @@
"count": 1
}
},
- "web/app/components/workflow/nodes/variable-assigner/use-single-run-form-params.ts": {
- "typescript/no-explicit-any": {
- "count": 5
- }
- },
"web/app/components/workflow/note-node/note-editor/index.tsx": {
"no-barrel-files/no-barrel-files": {
"count": 3
@@ -3400,14 +3177,6 @@
},
"jsx-a11y/no-static-element-interactions": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
- "web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx": {
- "typescript/no-explicit-any": {
- "count": 2
}
},
"web/app/components/workflow/panel/chat-variable-panel/components/object-value-item.tsx": {
@@ -3494,7 +3263,7 @@
"count": 2
},
"typescript/no-explicit-any": {
- "count": 7
+ "count": 6
}
},
"web/app/components/workflow/panel/debug-and-preview/user-input.tsx": {
@@ -3717,11 +3486,6 @@
"count": 10
}
},
- "web/app/components/workflow/utils/node-navigation.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/app/components/workflow/utils/node.ts": {
"regexp/no-super-linear-backtracking": {
"count": 1
@@ -3845,26 +3609,11 @@
"count": 7
}
},
- "web/app/reset-password/layout.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
- "web/app/signin/layout.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/app/signin/normal-form.tsx": {
"@tanstack/query/prefer-query-options": {
"count": 1
}
},
- "web/app/signup/layout.tsx": {
- "typescript/no-explicit-any": {
- "count": 1
- }
- },
"web/context/hooks/use-trigger-events-limit-modal.ts": {
"eslint-react/set-state-in-effect": {
"count": 1
@@ -3943,7 +3692,7 @@
},
"web/hooks/use-mitt.ts": {
"typescript/no-explicit-any": {
- "count": 2
+ "count": 1
}
},
"web/hooks/use-pay.tsx": {
@@ -3963,7 +3712,7 @@
},
"web/models/pipeline.ts": {
"typescript/no-explicit-any": {
- "count": 2
+ "count": 1
}
},
"web/models/share.ts": {
@@ -4030,17 +3779,11 @@
"web/service/common.ts": {
"no-restricted-imports": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/service/debug.ts": {
"no-restricted-imports": {
"count": 2
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/service/fetch.spec.ts": {
@@ -4051,9 +3794,6 @@
"web/service/fetch.ts": {
"no-restricted-imports": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 2
}
},
"web/service/log.ts": {
@@ -4076,7 +3816,7 @@
"count": 2
},
"typescript/no-explicit-any": {
- "count": 3
+ "count": 1
}
},
"web/service/sso.ts": {
@@ -4098,9 +3838,6 @@
},
"no-restricted-imports": {
"count": 1
- },
- "typescript/no-explicit-any": {
- "count": 4
}
},
"web/service/use-plugins.ts": {
@@ -4139,9 +3876,6 @@
"web/service/use-workflow.ts": {
"@tanstack/query/prefer-query-options": {
"count": 6
- },
- "typescript/no-explicit-any": {
- "count": 1
}
},
"web/service/webapp-auth.ts": {
@@ -4169,7 +3903,7 @@
},
"web/types/pipeline.tsx": {
"typescript/no-explicit-any": {
- "count": 2
+ "count": 1
}
},
"web/types/workflow.ts": {
@@ -4192,11 +3926,6 @@
"count": 1
}
},
- "web/utils/gtag.ts": {
- "typescript/no-explicit-any": {
- "count": 2
- }
- },
"web/utils/index.spec.ts": {
"dify/require-disable-directive-description": {
"count": 1
@@ -4204,7 +3933,7 @@
},
"web/utils/index.ts": {
"typescript/no-explicit-any": {
- "count": 3
+ "count": 1
}
},
"web/utils/mcp.ts": {
diff --git a/web/app/(shareLayout)/webapp-reset-password/layout.tsx b/web/app/(shareLayout)/webapp-reset-password/layout.tsx
index 5fa253d0357..c0f876f1eef 100644
--- a/web/app/(shareLayout)/webapp-reset-password/layout.tsx
+++ b/web/app/(shareLayout)/webapp-reset-password/layout.tsx
@@ -5,6 +5,6 @@ export function generateMetadata() {
return getRouteMetadata('login', ($) => $.resetPassword)
}
-export default function SignInLayout({ children }: any) {
+export default function SignInLayout({ children }: { children: React.ReactNode }) {
return <ResetPasswordLayout>{children}</ResetPasswordLayout>
}
diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx
index d0ace9e96e4..00ba0790149 100644
--- a/web/app/components/app/configuration/config-var/config-modal/index.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx
@@ -55,7 +55,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
const { modelConfig } = useContext(ConfigContext)
const { t } = useTranslation(['appDebug', 'workflow'])
const [tempPayload, setTempPayload] = useState<InputVar>(() =>
- normalizeSelectDefaultValue(payload || (getNewVarInWorkflow('') as any)),
+ normalizeSelectDefaultValue(payload || getNewVarInWorkflow('')),
)
const [validationError, setValidationError] = useState<ConfigModalValidationError>()
const queryClient = useQueryClient()
@@ -99,7 +99,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
[t],
)
const handlePayloadChange = useCallback((key: string) => {
- return (value: any) => {
+ return (value: unknown) => {
setTempPayload((prev) => updatePayloadField(prev, key, value))
setValidationError((prev) => (prev?.field === key ? undefined : prev))
}
@@ -138,7 +138,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
}, [])
const handleVarKeyBlur = useCallback(
- (e: any) => {
+ (e: ChangeEvent<HTMLInputElement>) => {
const varName = e.target.value
if (!checkVariableName(varName, true) || tempPayload.label) return
@@ -154,7 +154,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
)
const handleVarNameChange = useCallback(
- (e: ChangeEvent<any>) => {
+ (e: ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscoreInVarNameInput(e.target)
const value = e.target.value
const { isValid, errorKey, errorMessageKey } = checkKeys([value], true)
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
index c8e34760b69..5628007c6d4 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
@@ -90,7 +90,7 @@ const AgentTools: FC = () => {
const handleToolSettingChange = (value: Record<string, any>) => {
const newModelConfig = produce(modelConfig, (draft) => {
const tool = draft.agentConfig.tools.find(
- (item: any) =>
+ (item) =>
item.provider_id === currentTool?.provider_id &&
item.tool_name === currentTool?.tool_name,
)
@@ -149,7 +149,7 @@ const AgentTools: FC = () => {
(credentialId: string) => {
const newModelConfig = produce(modelConfig, (draft) => {
const tool = draft.agentConfig.tools.find(
- (item: any) =>
+ (item) =>
item.provider_id === currentTool?.provider_id &&
item.tool_name === currentTool?.tool_name,
)
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
index 48d6ed13a4f..1d0f05001a5 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
@@ -147,7 +147,7 @@ const ChatItem: FC<ChatItemProps> = ({ modelAndParameter }) => {
const allToolIcons = useMemo(() => {
const icons: Record<string, any> = {}
modelConfig.agentConfig.tools?.forEach((item: any) => {
- icons[item.tool_name] = collectionList.find((collection: any) =>
+ icons[item.tool_name] = collectionList.find((collection) =>
matchesProviderReference(collection, item.provider_id),
)?.icon
})
diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
index 7234903ae1a..320b802b9cc 100644
--- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
@@ -166,7 +166,7 @@ const DebugWithSingleModel = ({
const allToolIcons = useMemo(() => {
const icons: Record<string, any> = {}
modelConfig.agentConfig.tools?.forEach((item: any) => {
- icons[item.tool_name] = collectionList.find((collection: any) =>
+ icons[item.tool_name] = collectionList.find((collection) =>
matchesProviderReference(collection, item.provider_id),
)?.icon
})
diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx
index ed1d7f64309..60c9eb57e0e 100644
--- a/web/app/components/app/configuration/debug/index.tsx
+++ b/web/app/components/app/configuration/debug/index.tsx
@@ -345,7 +345,7 @@ const Debug: FC<IDebug> = ({
sendTextCompletion()
}
- const varList = modelConfig.configs.prompt_variables.map((item: any) => {
+ const varList = modelConfig.configs.prompt_variables.map((item) => {
return {
label: item.key,
value: inputs[item.key],
diff --git a/web/app/components/base/agent-log-modal/result.tsx b/web/app/components/base/agent-log-modal/result.tsx
index ce11afda408..8c1aa1c83a1 100644
--- a/web/app/components/base/agent-log-modal/result.tsx
+++ b/web/app/components/base/agent-log-modal/result.tsx
@@ -11,8 +11,8 @@ type ResultPanelProps = Readonly<{
elapsed_time?: number
total_tokens?: number
error?: string
- inputs?: any
- outputs?: any
+ inputs?: string | object
+ outputs?: string | object
created_by?: string
created_at: string
agentMode?: string
diff --git a/web/app/components/base/auto-height-textarea/index.stories.tsx b/web/app/components/base/auto-height-textarea/index.stories.tsx
index 3c971a86f5c..09ea8f3943d 100644
--- a/web/app/components/base/auto-height-textarea/index.stories.tsx
+++ b/web/app/components/base/auto-height-textarea/index.stories.tsx
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
+import type { ComponentProps } from 'react'
import { useState } from 'react'
import AutoHeightTextarea from '.'
@@ -60,7 +61,7 @@ export default meta
type Story = StoryObj<typeof meta>
// Interactive demo wrapper
-const AutoHeightTextareaDemo = (args: any) => {
+const AutoHeightTextareaDemo = (args: ComponentProps<typeof AutoHeightTextarea>) => {
const [value, setValue] = useState(args.value || '')
return (
diff --git a/web/app/components/base/chat/chat-with-history/context.ts b/web/app/components/base/chat/chat-with-history/context.ts
index b6935e3db95..869687bb9f4 100644
--- a/web/app/components/base/chat/chat-with-history/context.ts
+++ b/web/app/components/base/chat/chat-with-history/context.ts
@@ -23,7 +23,7 @@ export type ChatWithHistoryContextValue = {
handleNewConversationInputsChange: (v: Record<string, any>) => void
inputsForms: any[]
handleNewConversation: () => void
- handleStartChat: (callback?: any) => void
+ handleStartChat: (callback?: () => void) => void
handleChangeConversation: (conversationId: string) => void
handlePinConversation: (conversationId: string) => void
handleUnpinConversation: (conversationId: string) => void
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx
index 2755b2ed66b..1b80d3c6948 100644
--- a/web/app/components/base/chat/chat-with-history/hooks.tsx
+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx
@@ -472,7 +472,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledAppResponse) => {
[inputsForms, t, allInputsHidden],
)
const handleStartChat = useCallback(
- (callback: any) => {
+ (callback?: () => void) => {
if (checkInputsRequired()) {
setShowNewConversationItemInList(true)
callback?.()
diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.ts
index b5ce800b0ae..7e1104db594 100644
--- a/web/app/components/base/chat/chat/hooks.ts
+++ b/web/app/components/base/chat/chat/hooks.ts
@@ -537,7 +537,7 @@ export const useChat = (
}, [stopChat, handleResponding, resetWorkflowEventsSubscription])
const handleRestart = useCallback(
- (cb?: any) => {
+ (cb?: () => void) => {
conversationIdRef.current = initialConversationIdRef.current
taskIdRef.current = ''
handleStop()
diff --git a/web/app/components/base/chat/chat/type.ts b/web/app/components/base/chat/chat/type.ts
index 22299ba1ae4..f2426590440 100644
--- a/web/app/components/base/chat/chat/type.ts
+++ b/web/app/components/base/chat/chat/type.ts
@@ -17,7 +17,7 @@ export type FeedbackType = {
}
export type FeedbackFunc = (messageId: string, feedback: FeedbackType) => Promise<void>
-export type SubmitAnnotationFunc = (messageId: string, content: string) => Promise<any>
+export type SubmitAnnotationFunc = (messageId: string, content: string) => Promise<unknown>
export type ToolInfoInThought = {
name: string
diff --git a/web/app/components/base/chat/embedded-chatbot/context.ts b/web/app/components/base/chat/embedded-chatbot/context.ts
index 64c91694c36..9e28276c2d7 100644
--- a/web/app/components/base/chat/embedded-chatbot/context.ts
+++ b/web/app/components/base/chat/embedded-chatbot/context.ts
@@ -23,7 +23,7 @@ export type EmbeddedChatbotContextValue = {
handleNewConversationInputsChange: (v: Record<string, any>) => void
inputsForms: any[]
handleNewConversation: () => void
- handleStartChat: (callback?: any) => void
+ handleStartChat: (callback?: () => void) => void
handleChangeConversation: (conversationId: string) => void
handleNewConversationCompleted: (newConversationId: string) => void
chatShouldReloadKey: string
diff --git a/web/app/components/base/chat/utils.ts b/web/app/components/base/chat/utils.ts
index 552fd645421..176357bcebd 100644
--- a/web/app/components/base/chat/utils.ts
+++ b/web/app/components/base/chat/utils.ts
@@ -31,9 +31,9 @@ async function getRawInputsFromUrlParams(): Promise<Record<string, any>> {
return inputs
}
-async function getProcessedInputsFromUrlParams(): Promise<Record<string, any>> {
+async function getProcessedInputsFromUrlParams(): Promise<Record<string, string | undefined>> {
const urlParams = new URLSearchParams(window.location.search)
- const inputs: Record<string, any> = {}
+ const inputs: Record<string, string | undefined> = {}
const entriesArray = Array.from(urlParams.entries())
await Promise.all(
entriesArray.map(async ([key, value]) => {
@@ -45,7 +45,9 @@ async function getProcessedInputsFromUrlParams(): Promise<Record<string, any>> {
return inputs
}
-async function getProcessedSystemVariablesFromUrlParams(): Promise<Record<string, any>> {
+async function getProcessedSystemVariablesFromUrlParams(): Promise<
+ Record<string, string | undefined>
+> {
const urlParams = new URLSearchParams(window.location.search)
const redirectUrl = urlParams.get('redirect_url')
if (redirectUrl) {
@@ -56,7 +58,7 @@ async function getProcessedSystemVariablesFromUrlParams(): Promise<Record<string
for (const [key, value] of redirectParams.entries()) urlParams.set(key, value)
}
}
- const systemVariables: Record<string, any> = {}
+ const systemVariables: Record<string, string | undefined> = {}
const entriesArray = Array.from(urlParams.entries())
await Promise.all(
entriesArray.map(async ([key, value]) => {
@@ -67,9 +69,11 @@ async function getProcessedSystemVariablesFromUrlParams(): Promise<Record<string
return systemVariables
}
-async function getProcessedUserVariablesFromUrlParams(): Promise<Record<string, any>> {
+async function getProcessedUserVariablesFromUrlParams(): Promise<
+ Record<string, string | undefined>
+> {
const urlParams = new URLSearchParams(window.location.search)
- const userVariables: Record<string, any> = {}
+ const userVariables: Record<string, string | undefined> = {}
const entriesArray = Array.from(urlParams.entries())
await Promise.all(
entriesArray.map(async ([key, value]) => {
@@ -80,9 +84,9 @@ async function getProcessedUserVariablesFromUrlParams(): Promise<Record<string,
return userVariables
}
-async function getRawUserVariablesFromUrlParams(): Promise<Record<string, any>> {
+async function getRawUserVariablesFromUrlParams(): Promise<Record<string, string>> {
const urlParams = new URLSearchParams(window.location.search)
- const userVariables: Record<string, any> = {}
+ const userVariables: Record<string, string> = {}
const entriesArray = Array.from(urlParams.entries())
await Promise.all(
entriesArray.map(async ([key, value]) => {
diff --git a/web/app/components/base/error-boundary/index.tsx b/web/app/components/base/error-boundary/index.tsx
index 0c30e9a8cff..c00904bbb7c 100644
--- a/web/app/components/base/error-boundary/index.tsx
+++ b/web/app/components/base/error-boundary/index.tsx
@@ -50,7 +50,7 @@ class ErrorBoundaryInner extends React.Component<
},
ErrorBoundaryState
> {
- constructor(props: any) {
+ constructor(props: ErrorBoundaryInner['props']) {
super(props)
this.state = {
hasError: false,
@@ -81,7 +81,7 @@ class ErrorBoundaryInner extends React.Component<
if (this.props.onError) this.props.onError(error, errorInfo)
}
- override componentDidUpdate(prevProps: any) {
+ override componentDidUpdate(prevProps: ErrorBoundaryInner['props']) {
const { resetKeys, resetOnPropsChange } = this.props
const { hasError } = this.state
diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.ts
index 91d53b5f4ae..7f13c921582 100644
--- a/web/app/components/base/file-uploader/utils.ts
+++ b/web/app/components/base/file-uploader/utils.ts
@@ -46,7 +46,7 @@ type FileUploadParams = {
file: File
onProgressCallback: (progress: number) => void
onSuccessCallback: (res: FileUploadResponse) => void
- onErrorCallback: (error?: any) => void
+ onErrorCallback: (error?: unknown) => void
}
type FileUpload = (v: FileUploadParams, isPublic?: boolean, url?: string) => void
export const fileUpload: FileUpload = (
diff --git a/web/app/components/base/form/form-scenarios/base/field.tsx b/web/app/components/base/form/form-scenarios/base/field.tsx
index 089271c3f2a..afe4585fbc1 100644
--- a/web/app/components/base/form/form-scenarios/base/field.tsx
+++ b/web/app/components/base/form/form-scenarios/base/field.tsx
@@ -5,7 +5,7 @@ import { withForm } from '../..'
import { BaseFieldType } from './types'
type BaseFieldProps = {
- initialData?: Record<string, any>
+ initialData?: Record<string, unknown>
config: BaseConfiguration
}
diff --git a/web/app/components/base/form/form-scenarios/input-field/field.tsx b/web/app/components/base/form/form-scenarios/input-field/field.tsx
index 274a4424ea6..79d4b62f6db 100644
--- a/web/app/components/base/form/form-scenarios/input-field/field.tsx
+++ b/web/app/components/base/form/form-scenarios/input-field/field.tsx
@@ -5,7 +5,7 @@ import { withForm } from '../..'
import { InputFieldType } from './types'
type InputFieldProps = {
- initialData?: Record<string, any>
+ initialData?: Record<string, unknown>
config: InputFieldConfiguration
}
diff --git a/web/app/components/base/form/hooks/use-check-validated.ts b/web/app/components/base/form/hooks/use-check-validated.ts
index 9dbdaca8016..4bd4d096013 100644
--- a/web/app/components/base/form/hooks/use-check-validated.ts
+++ b/web/app/components/base/form/hooks/use-check-validated.ts
@@ -25,7 +25,7 @@ export const useCheckValidated = (
acc[condition.variable] = values[condition.variable]
return acc
},
- {} as Record<string, any>,
+ {} as Record<string, unknown>,
)
const show = show_on?.every((condition) => {
const conditionValue = showOnValues[condition.variable]
diff --git a/web/app/components/base/form/hooks/use-get-validators.ts b/web/app/components/base/form/hooks/use-get-validators.ts
index 5d850abb1b8..82b99cb9869 100644
--- a/web/app/components/base/form/hooks/use-get-validators.ts
+++ b/web/app/components/base/form/hooks/use-get-validators.ts
@@ -22,21 +22,21 @@ export const useGetValidators = () => {
const memorizedLabel = getLabel(label)
if (required && !validators) {
mergedValidators = {
- onMount: ({ value }: any) => {
+ onMount: ({ value }: { value: unknown }) => {
if (!value && value !== 0)
return t(($) => $['errorMsg.fieldRequired'], {
ns: 'common',
field: memorizedLabel || name,
})
},
- onChange: ({ value }: any) => {
+ onChange: ({ value }: { value: unknown }) => {
if (!value && value !== 0)
return t(($) => $['errorMsg.fieldRequired'], {
ns: 'common',
field: memorizedLabel || name,
})
},
- onBlur: ({ value }: any) => {
+ onBlur: ({ value }: { value: unknown }) => {
if (!value && value !== 0)
return t(($) => $['errorMsg.fieldRequired'], {
ns: 'common',
diff --git a/web/app/components/base/form/utils/secret-input/index.ts b/web/app/components/base/form/utils/secret-input/index.ts
index 7cb2d2a0273..539eed20d39 100644
--- a/web/app/components/base/form/utils/secret-input/index.ts
+++ b/web/app/components/base/form/utils/secret-input/index.ts
@@ -4,9 +4,9 @@ import { FormTypeEnum } from '@/app/components/base/form/types'
export const transformFormSchemasSecretInput = (
isPristineSecretInputNames: string[],
- values: Record<string, any>,
+ values: Record<string, unknown>,
) => {
- const transformedValues: Record<string, any> = { ...values }
+ const transformedValues: Record<string, unknown> = { ...values }
isPristineSecretInputNames.forEach((name) => {
if (transformedValues[name]) transformedValues[name] = '[__HIDDEN__]'
diff --git a/web/app/components/base/image-uploader/hooks.ts b/web/app/components/base/image-uploader/hooks.ts
index 31fbcb6ead3..b5d31d74e59 100644
--- a/web/app/components/base/image-uploader/hooks.ts
+++ b/web/app/components/base/image-uploader/hooks.ts
@@ -97,7 +97,7 @@ export const useImageFiles = () => {
filesRef.current = newFiles
setFiles(newFiles)
},
- onErrorCallback: (error?: any) => {
+ onErrorCallback: (error) => {
const errorMessage = getImageUploadErrorMessage(
error,
t(($) => $['imageUploader.uploadFromComputerUploadError'], { ns: 'common' }),
@@ -182,7 +182,7 @@ export const useLocalFileUploader = ({
onSuccessCallback: (res) => {
onUpload({ ...imageFile, fileId: res.id, progress: 100 })
},
- onErrorCallback: (error?: any) => {
+ onErrorCallback: (error) => {
const errorMessage = getImageUploadErrorMessage(
error,
t(($) => $['imageUploader.uploadFromComputerUploadError'], { ns: 'common' }),
diff --git a/web/app/components/base/image-uploader/utils.ts b/web/app/components/base/image-uploader/utils.ts
index 55b6770278d..4f20de0c07f 100644
--- a/web/app/components/base/image-uploader/utils.ts
+++ b/web/app/components/base/image-uploader/utils.ts
@@ -28,7 +28,7 @@ type ImageUploadParams = {
file: File
onProgressCallback: (progress: number) => void
onSuccessCallback: (res: { id: string }) => void
- onErrorCallback: (error?: any) => void
+ onErrorCallback: (error?: unknown) => void
}
type ImageUpload = (v: ImageUploadParams, isPublic?: boolean, url?: string) => void
export const imageUpload: ImageUpload = (
diff --git a/web/app/components/base/markdown-blocks/code-block.tsx b/web/app/components/base/markdown-blocks/code-block.tsx
index 59a6f2c7da1..5881d4c8bc6 100644
--- a/web/app/components/base/markdown-blocks/code-block.tsx
+++ b/web/app/components/base/markdown-blocks/code-block.tsx
@@ -1,3 +1,6 @@
+import type { EChartsOption, EChartsType } from 'echarts'
+import type EChartsReact from 'echarts-for-react'
+import type { EChartsReactProps } from 'echarts-for-react'
import type { JSX } from 'react'
import type { CodeTheme } from './shiki-highlight'
import { IconButton } from '@langgenius/dify-ui/icon-button'
@@ -144,21 +147,21 @@ type EChartsEventParams = {
seriesIndex?: number
dataIndex?: number
name?: string
- value?: any
+ value?: unknown
currentIndex?: number // Added for timeline events
- [key: string]: any
+ [key: string]: unknown
}
export const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any) => {
const { theme } = useTheme()
const [isSVG, setIsSVG] = useState(true)
const [chartState, setChartState] = useState<'loading' | 'success' | 'error'>('loading')
- const [finalChartOption, setFinalChartOption] = useState<any>(null)
- const echartsRef = useRef<any>(null)
+ const [finalChartOption, setFinalChartOption] = useState<EChartsOption | null>(null)
+ const echartsRef = useRef<EChartsReact | null>(null)
const contentRef = useRef<string>('')
const processedRef = useRef<boolean>(false) // Track if content was successfully processed
const isInitialRenderRef = useRef<boolean>(true) // Track if this is initial render
- const chartInstanceRef = useRef<any>(null) // Direct reference to ECharts instance
+ const chartInstanceRef = useRef<EChartsType | null>(null) // Direct reference to ECharts instance
const resizeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null) // For debounce handling
const chartReadyTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const finishedEventCountRef = useRef<number>(0) // Track finished event trigger count
@@ -189,12 +192,11 @@ export const CodeBlock: any = memo(({ inline, className, children = '', ...props
[],
)
- const echartsOpts = useMemo(
- () =>
- ({
- renderer: 'canvas',
- width: 'auto',
- }) as any,
+ const echartsOpts = useMemo<EChartsReactProps['opts']>(
+ () => ({
+ renderer: 'canvas',
+ width: 'auto',
+ }),
[],
)
@@ -210,7 +212,7 @@ export const CodeBlock: any = memo(({ inline, className, children = '', ...props
// Handle ECharts instance initialization
const handleChartReady = useCallback(
- (instance: any) => {
+ (instance: EChartsType) => {
chartInstanceRef.current = instance
// Force resize to ensure timeline displays correctly
diff --git a/web/app/components/base/markdown/error-boundary.tsx b/web/app/components/base/markdown/error-boundary.tsx
index 8113622044a..82c80de5d7e 100644
--- a/web/app/components/base/markdown/error-boundary.tsx
+++ b/web/app/components/base/markdown/error-boundary.tsx
@@ -11,20 +11,21 @@ import { Component } from 'react'
// Avoid error #7832 (Crash when ECharts accesses undefined objects)
// This can happen when a component attempts to access an undefined object that references an unregistered map, causing the program to crash.
-export default class ErrorBoundary extends Component {
- constructor(props: any) {
+export default class ErrorBoundary extends Component<
+ React.PropsWithChildren,
+ { hasError: boolean }
+> {
+ constructor(props: React.PropsWithChildren) {
super(props)
this.state = { hasError: false }
}
- override componentDidCatch(error: any, errorInfo: any) {
+ override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
this.setState({ hasError: true })
console.error(error, errorInfo)
}
override render() {
- // oxlint-disable-next-line typescript/ban-ts-comment
- // @ts-expect-error
if (this.state.hasError) {
return (
<div>
@@ -35,8 +36,6 @@ export default class ErrorBoundary extends Component {
</div>
)
}
- // oxlint-disable-next-line typescript/ban-ts-comment
- // @ts-expect-error
return this.props.children
}
}
diff --git a/web/app/components/base/mermaid/index.tsx b/web/app/components/base/mermaid/index.tsx
index 16233a70473..fcc0ca5d05a 100644
--- a/web/app/components/base/mermaid/index.tsx
+++ b/web/app/components/base/mermaid/index.tsx
@@ -159,7 +159,7 @@ const Flowchart = (props: FlowchartProps) => {
/**
* Handle rendering errors
*/
- const handleRenderError = (error: any) => {
+ const handleRenderError = (error: unknown) => {
console.error('Mermaid rendering error:', error)
// On any render error, assume the mermaid state is corrupted and force a re-initialization.
diff --git a/web/app/components/base/mermaid/utils.ts b/web/app/components/base/mermaid/utils.ts
index bce7cdd7974..0cfe03bddc2 100644
--- a/web/app/components/base/mermaid/utils.ts
+++ b/web/app/components/base/mermaid/utils.ts
@@ -211,11 +211,11 @@ export function isMermaidCodeComplete(code: string): boolean {
/**
* Helper to wait for DOM element with retry mechanism
*/
-export function waitForDOMElement(
- callback: () => Promise<any>,
+export function waitForDOMElement<T>(
+ callback: () => Promise<T>,
maxAttempts = 3,
delay = 100,
-): Promise<any> {
+): Promise<T> {
return new Promise((resolve, reject) => {
let attempts = 0
const tryRender = async () => {
diff --git a/web/app/components/base/new-audio-button/index.tsx b/web/app/components/base/new-audio-button/index.tsx
index 68ce0136c9a..ee32739785b 100644
--- a/web/app/components/base/new-audio-button/index.tsx
+++ b/web/app/components/base/new-audio-button/index.tsx
@@ -21,7 +21,7 @@ const AudioBtn = ({ id, voice, value }: AudioBtnProps) => {
const params = useParams()
const pathname = usePathname()
- const audio_finished_call = (event: string): any => {
+ const audio_finished_call = (event: string): void => {
switch (event) {
case 'ended':
setAudioState('ended')
diff --git a/web/app/components/base/prompt-editor/index.stories.tsx b/web/app/components/base/prompt-editor/index.stories.tsx
index 91051fb30ed..f3161766bd2 100644
--- a/web/app/components/base/prompt-editor/index.stories.tsx
+++ b/web/app/components/base/prompt-editor/index.stories.tsx
@@ -1,6 +1,16 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { useState } from 'react'
+type PromptEditorMockProps = {
+ value?: string
+ onChange?: (value: string) => void
+ placeholder?: string
+ editable?: boolean
+ compact?: boolean
+ className?: string
+ wrapperClassName?: string
+}
+
// Mock component to avoid complex initialization issues
const PromptEditorMock = ({
value,
@@ -10,7 +20,7 @@ const PromptEditorMock = ({
compact,
className,
wrapperClassName,
-}: any) => {
+}: PromptEditorMockProps) => {
const [content, setContent] = useState(value || '')
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
@@ -77,7 +87,7 @@ export default meta
type Story = StoryObj<typeof meta>
// Interactive demo wrapper
-const PromptEditorDemo = (args: any) => {
+const PromptEditorDemo = (args: PromptEditorMockProps) => {
const [value, setValue] = useState(args.value || '')
return (
diff --git a/web/app/components/base/prompt-editor/plugins/draggable-plugin/index.tsx b/web/app/components/base/prompt-editor/plugins/draggable-plugin/index.tsx
index 7255c5ab404..0cf7f8eb9a3 100644
--- a/web/app/components/base/prompt-editor/plugins/draggable-plugin/index.tsx
+++ b/web/app/components/base/prompt-editor/plugins/draggable-plugin/index.tsx
@@ -49,8 +49,8 @@ export default function DraggableBlockPlugin({
return (
<DraggableBlockPlugin_EXPERIMENTAL
anchorElem={anchorElem}
- menuRef={menuRef as any}
- targetLineRef={targetLineRef as any}
+ menuRef={menuRef}
+ targetLineRef={targetLineRef}
menuComponent={
isSupportDrag ? (
<div
diff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/node.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/node.tsx
index 257c29a203c..ac2775c8385 100644
--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/node.tsx
+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/node.tsx
@@ -40,7 +40,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
constructor(
variables: string[],
workflowNodesMap: WorkflowNodesMap,
- getVarType: any,
+ getVarType: GetVarType | undefined,
key?: NodeKey,
availableVariables?: NodeOutPutVar[],
) {
@@ -108,7 +108,7 @@ export class WorkflowVariableBlockNode extends DecoratorNode<React.JSX.Element>
return self.__workflowNodesMap
}
- getVarType(): any {
+ getVarType(): GetVarType | undefined {
const self = this.getLatest()
return self.__getVarType
}
diff --git a/web/app/components/base/tag-input/index.stories.tsx b/web/app/components/base/tag-input/index.stories.tsx
index 1d41dd24a25..ffffcabe9d0 100644
--- a/web/app/components/base/tag-input/index.stories.tsx
+++ b/web/app/components/base/tag-input/index.stories.tsx
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
+import type { ComponentProps } from 'react'
import { useState } from 'react'
import TagInput from '.'
@@ -57,7 +58,7 @@ export default meta
type Story = StoryObj<typeof meta>
// Interactive demo wrapper
-const TagInputDemo = (args: any) => {
+const TagInputDemo = (args: ComponentProps<typeof TagInput>) => {
const [items, setItems] = useState(args.items || [])
return (
diff --git a/web/app/components/base/text-generation/hooks.ts b/web/app/components/base/text-generation/hooks.ts
index c0c481057b1..f291badb9ee 100644
--- a/web/app/components/base/text-generation/hooks.ts
+++ b/web/app/components/base/text-generation/hooks.ts
@@ -12,7 +12,11 @@ export const useTextGeneration = () => {
const [isResponding, setIsResponding] = useState(false)
const [completion, setCompletion] = useState('')
const [messageId, setMessageId] = useState<string | null>(null)
- const handleSend = async (url: string, data: any, { onNotifyError }: SendOptions = {}) => {
+ const handleSend = async (
+ url: string,
+ data: Record<string, unknown>,
+ { onNotifyError }: SendOptions = {},
+ ) => {
if (isResponding) {
toast.info(t(($) => $['errorMessage.waitForResponse'], { ns: 'appDebug' }))
return false
diff --git a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts b/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
index 65b17dabc2e..61644491f81 100644
--- a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
+++ b/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
@@ -151,7 +151,7 @@ export const useUpload = () => {
onSuccessCallback: (res) => {
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
},
- onErrorCallback: (error?: any) => {
+ onErrorCallback: (error) => {
const errorMessage = getFileUploadErrorMessage(
error,
t(($) => $['fileUploader.uploadFromComputerUploadError'], { ns: 'common' }),
@@ -200,7 +200,7 @@ export const useUpload = () => {
progress: 100,
})
},
- onErrorCallback: (error?: any) => {
+ onErrorCallback: (error) => {
const errorMessage = getFileUploadErrorMessage(
error,
t(($) => $['fileUploader.uploadFromComputerUploadError'], { ns: 'common' }),
@@ -262,7 +262,7 @@ export const useUpload = () => {
if (!e.dataTransfer) return
const nested = await Promise.all(
Array.from(e.dataTransfer.items).map((it) => {
- const entry = (it as any).webkitGetAsEntry?.()
+ const entry = it.webkitGetAsEntry?.()
if (entry) return traverseFileEntry(entry)
const f = it.getAsFile?.()
return f ? Promise.resolve([f]) : Promise.resolve([])
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts
index a5b0de4f607..993672d0868 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts
@@ -26,12 +26,12 @@ export const convertOnlineDriveData = (
): {
fileList: OnlineDriveFile[]
isTruncated: boolean
- nextPageParameters: Record<string, any>
+ nextPageParameters: Record<string, unknown>
hasBucket: boolean
} => {
const fileList: OnlineDriveFile[] = []
let isTruncated = false
- let nextPageParameters: Record<string, any> = {}
+ let nextPageParameters: Record<string, unknown> = {}
let hasBucket = false
if (data.length === 0) return { fileList, isTruncated, nextPageParameters, hasBucket }
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/store/slices/online-drive.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/store/slices/online-drive.ts
index feebc674696..1d3a4db9c6d 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/store/slices/online-drive.ts
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/store/slices/online-drive.ts
@@ -14,9 +14,9 @@ export type OnlineDriveSliceShape = {
setOnlineDriveFileList: (onlineDriveFileList: OnlineDriveFile[]) => void
bucket: string
setBucket: (bucket: string) => void
- nextPageParameters: Record<string, any>
- currentNextPageParametersRef: React.RefObject<Record<string, any>>
- setNextPageParameters: (nextPageParameters: Record<string, any>) => void
+ nextPageParameters: Record<string, unknown>
+ currentNextPageParametersRef: React.RefObject<Record<string, unknown>>
+ setNextPageParameters: (nextPageParameters: Record<string, unknown>) => void
isTruncated: React.RefObject<boolean>
previewOnlineDriveFileRef: React.RefObject<OnlineDriveFile | undefined>
hasBucket: boolean
@@ -61,7 +61,7 @@ export const createOnlineDriveSlice: StateCreator<OnlineDriveSliceShape> = (set,
})),
nextPageParameters: {},
currentNextPageParametersRef: { current: {} },
- setNextPageParameters: (nextPageParameters: Record<string, any>) =>
+ setNextPageParameters: (nextPageParameters: Record<string, unknown>) =>
set(() => ({
nextPageParameters,
})),
diff --git a/web/app/components/datasets/documents/detail/context.ts b/web/app/components/datasets/documents/detail/context.ts
index b33c2aa88e5..a0cf2d14ecc 100644
--- a/web/app/components/datasets/documents/detail/context.ts
+++ b/web/app/components/datasets/documents/detail/context.ts
@@ -11,6 +11,6 @@ export type DocumentContextValue = {
export const DocumentContext = createContext<DocumentContextValue>({})
-export const useDocumentContext = (selector: (value: DocumentContextValue) => any) => {
+export const useDocumentContext = <T>(selector: (value: DocumentContextValue) => T) => {
return useContextSelector(DocumentContext, selector)
}
diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
index 8a83084308c..9977c036a9e 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
@@ -68,7 +68,7 @@ const SelectPackage: React.FC<SelectPackageProps> = ({
manifest: GitHubPackage.manifest,
})
})
- } catch (e: any) {
+ } catch (e) {
if (e instanceof Error && e.message) onFailed(e.message)
else onFailed(t(($) => $[`${i18nPrefix}.uploadFailed`], { ns: 'plugin' }))
} finally {
diff --git a/web/app/components/plugins/plugin-page/context.ts b/web/app/components/plugins/plugin-page/context.ts
index b7eff1a691b..b34628826c7 100644
--- a/web/app/components/plugins/plugin-page/context.ts
+++ b/web/app/components/plugins/plugin-page/context.ts
@@ -43,6 +43,6 @@ export const PluginPageContext = createContext<PluginPageContextValue>({
options: [],
})
-export function usePluginPageContext(selector: (value: PluginPageContextValue) => any) {
+export function usePluginPageContext<T>(selector: (value: PluginPageContextValue) => T) {
return useContextSelector(PluginPageContext, selector)
}
diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts
index e9ec6c44ebf..93f4b70440b 100644
--- a/web/app/components/plugins/types.ts
+++ b/web/app/components/plugins/types.ts
@@ -62,8 +62,8 @@ export type PluginDeclaration = {
label: Record<Locale | PluginLanguage, string>
description: Record<Locale | PluginLanguage, string>
created_at: string
- resource: any // useless in frontend
- plugins: any // useless in frontend
+ resource: unknown // useless in frontend
+ plugins: unknown // useless in frontend
verified: boolean
endpoint?: EndpointProviderDeclarationResponse | null
tool?: PluginToolDeclaration
@@ -111,15 +111,15 @@ export type ParametersSchema = {
name: string
label: Record<Locale | PluginLanguage, string>
type: FormTypeEnum
- auto_generate: any
- template: any
+ auto_generate: unknown
+ template: unknown
scope: any
required: boolean
multiple: boolean
default?: string | string[]
- min: any
- max: any
- precision: any
+ min: unknown
+ max: unknown
+ precision: unknown
options?: Array<{
value: string
label: Record<Locale | PluginLanguage, string>
@@ -132,15 +132,15 @@ export type TriggerEventParameter = {
name: string
label: TypeWithI18N
type: string
- auto_generate: any
- template: any
+ auto_generate: unknown
+ template: unknown
scope: any
required: boolean
multiple: boolean
default: any
- min: any
- max: any
- precision: any
+ min: unknown
+ max: unknown
+ precision: unknown
options?: Array<{
value: string
label: TypeWithI18N
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.tsx
index 677847204cb..63389b83b72 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.tsx
@@ -9,7 +9,7 @@ import Options from './options'
type DocumentProcessingProps = {
dataSourceNodeId: string
- onProcess: (data: Record<string, any>) => void
+ onProcess: (data: Record<string, unknown>) => void
onBack: () => void
}
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx
index b54ad05026b..925bec42275 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx
@@ -6,11 +6,11 @@ import BaseField from '@/app/components/base/form/form-scenarios/base/field'
import { toast } from '@/app/notifications'
type OptionsProps = {
- initialData: Record<string, any>
+ initialData: Record<string, unknown>
configurations: BaseConfiguration[]
schema: ZodSchema
CustomActions: (props: CustomActionsProps) => React.JSX.Element
- onSubmit: (data: Record<string, any>) => void
+ onSubmit: (data: Record<string, unknown>) => void
}
const Options = ({
initialData,
diff --git a/web/app/components/rag-pipeline/hooks/use-input-fields.ts b/web/app/components/rag-pipeline/hooks/use-input-fields.ts
index 12b6950a767..6ef96b1e903 100644
--- a/web/app/components/rag-pipeline/hooks/use-input-fields.ts
+++ b/web/app/components/rag-pipeline/hooks/use-input-fields.ts
@@ -6,7 +6,7 @@ import { VAR_TYPE_MAP } from '@/models/pipeline'
export const useInitialData = (
variables: RAGPipelineVariables,
- lastRunInputData?: Record<string, any>,
+ lastRunInputData?: Record<string, unknown>,
) => {
const initialData = useMemo(() => {
return variables.reduce(
@@ -30,7 +30,7 @@ export const useInitialData = (
if (fileFieldTypes.includes(type)) acc[variableName] = defaultValue ?? []
return acc
},
- {} as Record<string, any>,
+ {} as Record<string, unknown>,
)
}, [lastRunInputData, variables])
diff --git a/web/app/components/workflow/hooks/use-serial-async-callback.ts b/web/app/components/workflow/hooks/use-serial-async-callback.ts
index b88d75e1f49..b0eb3b688c8 100644
--- a/web/app/components/workflow/hooks/use-serial-async-callback.ts
+++ b/web/app/components/workflow/hooks/use-serial-async-callback.ts
@@ -1,7 +1,7 @@
import { useRefWithInit } from '@langgenius/dify-ui/use-ref-with-init'
import { useCallback } from 'react'
-export const useSerialAsyncCallback = <Args extends any[], Result = void>(
+export const useSerialAsyncCallback = <Args extends unknown[], Result = void>(
fn: (...args: Args) => Promise<Result> | Result,
shouldSkip?: () => boolean,
) => {
diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
index 893cf6d1e29..3ba5dcd87a9 100644
--- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
+++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
@@ -1,4 +1,5 @@
'use client'
+import type { OnMount } from '@monaco-editor/react'
import type { FC } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import Editor, { loader } from '@monaco-editor/react'
@@ -32,7 +33,7 @@ export type Props = Readonly<{
isJSONStringifyBeauty?: boolean
height?: number
isInNode?: boolean
- onMount?: (editor: any, monaco: any) => void
+ onMount?: OnMount
noWrapper?: boolean
isExpand?: boolean
showFileList?: boolean
@@ -86,7 +87,7 @@ const CodeEditor: FC<Props> = ({
return []
}, [value])
- const editorRef = useRef<any>(null)
+ const editorRef = useRef<Parameters<OnMount>[0] | null>(null)
const resizeEditorToContent = () => {
if (editorRef.current) {
const contentHeight = editorRef.current.getContentHeight() // Math.max(, minHeight)
@@ -101,7 +102,7 @@ const CodeEditor: FC<Props> = ({
}, 10)
}
- const handleEditorDidMount = (editor: any, monaco: any) => {
+ const handleEditorDidMount: OnMount = (editor, monaco) => {
editorRef.current = editor
resizeEditorToContent()
diff --git a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
index 488b9217d87..bf06c17b412 100644
--- a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
+++ b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
@@ -60,7 +60,7 @@ type Props = Readonly<{
editionType?: EditionType
onEditionTypeChange?: (editionType: EditionType) => void
varList?: Variable[]
- handleAddVariable?: (payload: any) => void
+ handleAddVariable?: (payload: Variable) => void
containerBackgroundClassName?: string
gradientBorder?: boolean
titleTooltip?: ReactNode
@@ -131,7 +131,7 @@ const Editor: FC<Props> = ({
const handleInsertVariable = () => {
setFocus()
- eventEmitter?.emit({ type: PROMPT_EDITOR_INSERT_QUICKLY, instanceId } as any)
+ eventEmitter?.emit({ type: PROMPT_EDITOR_INSERT_QUICKLY, instanceId })
}
const getVarType = useWorkflowVariableType()
@@ -351,7 +351,7 @@ const Editor: FC<Props> = ({
workflowVariableBlock={{
show: true,
variables: nodesOutputVars || [],
- getVarType: getVarType as any,
+ getVarType,
workflowNodesMap: availableNodes.reduce((acc, node) => {
acc[node.id] = {
title: node.data.title,
diff --git a/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx b/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx
index 5dbc051f480..bea175fae1c 100644
--- a/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx
+++ b/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx
@@ -18,7 +18,7 @@ const VAR_PLACEHOLDER = '@#!@#!'
const ReadonlyInputWithSelectVar: FC<Props> = ({ nodeId, value, className }) => {
const { getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
const availableNodes = getBeforeNodesInSameBranchIncludeParent(nodeId)
- const startNode = availableNodes.find((node: any) => {
+ const startNode = availableNodes.find((node) => {
return node.data.type === BlockEnum.Start
})
diff --git a/web/app/components/workflow/nodes/_base/components/setting-item.tsx b/web/app/components/workflow/nodes/_base/components/setting-item.tsx
index 872c2c1a4bf..f9e81671b47 100644
--- a/web/app/components/workflow/nodes/_base/components/setting-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/setting-item.tsx
@@ -14,7 +14,7 @@ type SettingItemProps = PropsWithChildren<{
export const SettingItem = memo(({ label, children, status, tooltip }: SettingItemProps) => {
const indicator: StatusDotStatus | undefined =
status === 'error' ? 'error' : status === 'warning' ? 'warning' : undefined
- const needTooltip = ['error', 'warning'].includes(status as any)
+ const needTooltip = status === 'error' || status === 'warning'
return (
<div className="relative flex items-center justify-between space-x-1 rounded-md bg-workflow-block-parma-bg px-1.5 py-1 text-xs font-normal">
<div
diff --git a/web/app/components/workflow/nodes/_base/components/variable/match-schema-type.ts b/web/app/components/workflow/nodes/_base/components/variable/match-schema-type.ts
index b5889a390ba..6d5d7f50afc 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/match-schema-type.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/match-schema-type.ts
@@ -1,10 +1,10 @@
-export type AnyObj = Record<string, any> | null
+export type AnyObj = object | null
-const isObj = (x: any): x is object => x !== null && typeof x === 'object'
+const isObj = (x: unknown): x is Record<string, unknown> => x !== null && typeof x === 'object'
// only compare type in object
function matchTheSchemaType(scheme: AnyObj, target: AnyObj): boolean {
- const isMatch = (schema: AnyObj, t: AnyObj): boolean => {
+ const isMatch = (schema: unknown, t: unknown): boolean => {
const oSchema = isObj(schema)
const oT = isObj(t)
if (!oSchema) return true
@@ -13,13 +13,13 @@ function matchTheSchemaType(scheme: AnyObj, target: AnyObj): boolean {
// deep find oSchema has type
for (const key in schema) {
if (key === 'type') return false
- if (isObj((schema as any)[key]) && !isMatch((schema as any)[key], null)) return false
+ if (isObj(schema[key]) && !isMatch(schema[key], null)) return false
}
return true
}
// check current `type`
- const tx = (schema as any).type
- const ty = (t as any).type
+ const tx = schema.type
+ const ty = t.type
const isTypeValueObj = isObj(tx)
if (!isTypeValueObj) {
@@ -28,10 +28,10 @@ function matchTheSchemaType(scheme: AnyObj, target: AnyObj): boolean {
}
// recurse into all keys
- const keys = new Set([...Object.keys(schema as object), ...Object.keys(t as object)])
+ const keys = new Set([...Object.keys(schema), ...Object.keys(t)])
for (const k of keys) {
if (k === 'type' && !isTypeValueObj) continue // already checked
- if (!isMatch((schema as any)[k], (t as any)[k])) return false
+ if (!isMatch(schema[k], t[k])) return false
}
return true
}
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
index aa90c63817b..50a155613f0 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
@@ -1283,7 +1283,7 @@ export const getNodeUsedVars = (node: Node, { forExecution = false } = {}): Valu
break
}
case BlockEnum.TemplateTransform: {
- res = (data as TemplateTransformNodeType).variables?.map((v: any) => {
+ res = (data as TemplateTransformNodeType).variables?.map((v) => {
return v.value_selector
})
break
@@ -1649,7 +1649,7 @@ export const updateNodeVars = (
case BlockEnum.TemplateTransform: {
const payload = data as TemplateTransformNodeType
if (payload.variables) {
- payload.variables = payload.variables.map((v: any) => {
+ payload.variables = payload.variables.map((v) => {
if (v.value_selector.join('.') === oldVarSelector.join('.'))
v.value_selector = newVarSelector
return v
diff --git a/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts b/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts
index dd7913eb79f..c1f8ab9596c 100644
--- a/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/assigner/use-single-run-form-params.ts
@@ -8,10 +8,10 @@ import { WriteMode, writeModeTypesNum } from './types'
type Params = {
id: string
payload: AssignerNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
varSelectorsToVarInputs: (variables: ValueSelector[]) => InputVar[]
}
diff --git a/web/app/components/workflow/nodes/code/use-single-run-form-params.ts b/web/app/components/workflow/nodes/code/use-single-run-form-params.ts
index 70d30ecc319..bdcbe442013 100644
--- a/web/app/components/workflow/nodes/code/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/code/use-single-run-form-params.ts
@@ -7,10 +7,10 @@ import useNodeCrud from '../_base/hooks/use-node-crud'
type Params = {
id: string
payload: CodeNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({
@@ -24,13 +24,13 @@ const useSingleRunFormParams = ({
const varInputs = toVarInputs(inputs.variables)
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/nodes/end/node.tsx b/web/app/components/workflow/nodes/end/node.tsx
index cd964152d2d..d69a3c46582 100644
--- a/web/app/components/workflow/nodes/end/node.tsx
+++ b/web/app/components/workflow/nodes/end/node.tsx
@@ -15,7 +15,7 @@ const Node: FC<NodeProps<EndNodeType>> = ({ id, data }) => {
const { getCurrentVariableType } = useWorkflowVariables()
const isChatflow = useAtomValue(isChatflowAtom)
- const startNode = availableNodes.find((node: any) => {
+ const startNode = availableNodes.find((node) => {
return node.data.type === BlockEnum.Start
})
diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
index f04d50f93b6..a9b44bff9d5 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
@@ -38,7 +38,7 @@ const KeyValueList: FC<Props> = ({
const handleChange = useCallback(
(index: number) => {
return (newItem: KeyValue) => {
- const newList = produce(list, (draft: any) => {
+ const newList = produce(list, (draft) => {
draft[index] = newItem
})
onChange(newList)
@@ -50,7 +50,7 @@ const KeyValueList: FC<Props> = ({
const handleRemove = useCallback(
(index: number) => {
return () => {
- const newList = produce(list, (draft: any) => {
+ const newList = produce(list, (draft) => {
draft.splice(index, 1)
})
onChange(newList)
diff --git a/web/app/components/workflow/nodes/http/use-single-run-form-params.ts b/web/app/components/workflow/nodes/http/use-single-run-form-params.ts
index 661325756a0..81664bed844 100644
--- a/web/app/components/workflow/nodes/http/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/http/use-single-run-form-params.ts
@@ -7,10 +7,10 @@ import useNodeCrud from '../_base/hooks/use-node-crud'
type Params = {
id: string
payload: HttpNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({
@@ -41,13 +41,13 @@ const useSingleRunFormParams = ({
fileVarInputs,
])
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts b/web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts
index 83a7b008680..59c0bf6a0b7 100644
--- a/web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts
@@ -6,10 +6,10 @@ import { useCallback } from 'react'
type Params = {
id: string
payload: IfElseNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
varSelectorsToVarInputs: (variables: ValueSelector[]) => InputVar[]
}
@@ -21,13 +21,13 @@ const useSingleRunFormParams = ({
varSelectorsToVarInputs,
}: Params) => {
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
index f0df513eaa8..c682e174ed9 100644
--- a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
@@ -20,10 +20,10 @@ const i18nPrefix = 'nodes.iteration'
type Params = {
id: string
payload: IterationNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
iterationRunResult: NodeTracing[]
}
@@ -114,13 +114,13 @@ const useSingleRunFormParams = ({
})()
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts
index 144f65dd811..31e5aec3036 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts
@@ -3,7 +3,7 @@ import type { HybridSearchModeEnum, RetrievalSearchMethodEnum } from '../../type
export type Option = {
id: RetrievalSearchMethodEnum
iconClassName: string
- title: any
+ title: React.ReactNode
description: string
effectColor?: string
showEffectColor?: boolean
diff --git a/web/app/components/workflow/nodes/llm/utils.ts b/web/app/components/workflow/nodes/llm/utils.ts
index 5a65127f4aa..87795bb7521 100644
--- a/web/app/components/workflow/nodes/llm/utils.ts
+++ b/web/app/components/workflow/nodes/llm/utils.ts
@@ -99,7 +99,7 @@ export const getHasChildren = (schema: Field) => {
)
}
-const getTypeOf = (target: any) => {
+const getTypeOf = (target: unknown) => {
if (target === null) return 'null'
if (typeof target !== 'object') {
return typeof target
@@ -108,7 +108,7 @@ const getTypeOf = (target: any) => {
}
}
-const inferType = (value: any): Type => {
+const inferType = (value: unknown): Type => {
const type = getTypeOf(value)
if (type === 'array') return Type.array
// type boolean will be treated as string
diff --git a/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx b/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
index 14da06f1298..6f8f013c5db 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
@@ -1,3 +1,4 @@
+import type { WorkflowNodesMap } from '@/app/components/base/prompt-editor/types'
import type { Node } from '@/app/components/workflow/types'
import { useAtomValue } from 'jotai'
import { useTranslation } from 'react-i18next'
@@ -27,7 +28,7 @@ const ConditionInput = ({ value, onChange, disabled, availableNodes }: Condition
workflowVariableBlock={{
show: true,
variables: [],
- workflowNodesMap: availableNodes.reduce((acc, node) => {
+ workflowNodesMap: availableNodes.reduce<WorkflowNodesMap>((acc, node) => {
acc[node.id] = {
title: node.data.title,
type: node.data.type,
@@ -39,7 +40,7 @@ const ConditionInput = ({ value, onChange, disabled, availableNodes }: Condition
}
}
return acc
- }, {} as any),
+ }, {}),
showManageInputField: resourceKind === 'knowledge-pipeline',
onManageInputField: () => setShowInputFieldPanel?.(true),
}}
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
index 88bd5435e1d..7a3dbe33fc0 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
@@ -39,7 +39,7 @@ const FormItem = ({ nodeId, item, onChange }: FormItemProps) => {
)
const handleChange = useCallback(
- (value: any) => {
+ (value: unknown) => {
onChange(value)
},
[onChange],
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
index 244c29bcee8..2db480bbaa5 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
@@ -7,21 +7,22 @@ import {
SelectTrigger,
} from '@langgenius/dify-ui/select'
import { useTranslation } from 'react-i18next'
+import { ValueType } from '@/app/components/workflow/types'
type InputModeSelectProps = {
- value?: string
- onChange: (value: string) => void
+ value?: ValueType
+ onChange: (value: ValueType) => void
}
const InputModeSelect = ({ value, onChange }: InputModeSelectProps) => {
const { t } = useTranslation(['workflowLogic'])
const options = [
{
label: 'Variable',
- value: 'variable',
+ value: ValueType.variable,
},
{
label: 'Constant',
- value: 'constant',
+ value: ValueType.constant,
},
]
const selectedOption = options.find((option) => option.value === value) ?? null
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
index fbd015dab25..97af09eb753 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
@@ -1,3 +1,4 @@
+import type { ChangeEvent } from 'react'
import type {
LoopVariable,
LoopVariablesComponentShape,
@@ -35,7 +36,7 @@ const Item = ({ nodeId, item, handleRemoveLoopVariable, handleUpdateLoopVariable
return true
}
const handleUpdateItemLabel = useCallback(
- (e: any) => {
+ (e: ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscoreInVarNameInput(e.target)
if (!!e.target.value && !checkVariableName(e.target.value)) return
handleUpdateLoopVariable(item.id, { label: e.target.value })
@@ -56,7 +57,7 @@ const Item = ({ nodeId, item, handleRemoveLoopVariable, handleUpdateLoopVariable
}, [])
const handleUpdateItemVarType = useCallback(
- (value: any) => {
+ (value: VarType) => {
handleUpdateLoopVariable(item.id, {
var_type: value,
value: getDefaultValue(value, item.value_type),
@@ -66,7 +67,7 @@ const Item = ({ nodeId, item, handleRemoveLoopVariable, handleUpdateLoopVariable
)
const handleUpdateItemValueType = useCallback(
- (value: any) => {
+ (value: ValueType) => {
handleUpdateLoopVariable(item.id, {
value_type: value,
value: getDefaultValue(item.var_type, value),
@@ -76,7 +77,7 @@ const Item = ({ nodeId, item, handleRemoveLoopVariable, handleUpdateLoopVariable
)
const handleUpdateItemValue = useCallback(
- (value: any) => {
+ (value: unknown) => {
handleUpdateLoopVariable(item.id, { value })
},
[item.id, handleUpdateLoopVariable],
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/variable-type-select.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/variable-type-select.tsx
index bac8a337ec8..623e2e4018e 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/variable-type-select.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/variable-type-select.tsx
@@ -9,8 +9,8 @@ import {
import { VarType } from '@/app/components/workflow/types'
type VariableTypeSelectProps = {
- value?: string
- onChange: (value: string) => void
+ value?: VarType
+ onChange: (value: VarType) => void
}
const VariableTypeSelect = ({ value, onChange }: VariableTypeSelectProps) => {
const options = [
diff --git a/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts b/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
index ceed20ebb4d..46ee0bd0f29 100644
--- a/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
@@ -17,10 +17,10 @@ import {
type Params = {
id: string
payload: LoopNodeType
- runInputData: Record<string, any>
+ runInputData: Record<string, unknown>
runResult: NodeTracing
loopRunResult: NodeTracing[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
varSelectorsToVarInputs: (variables: ValueSelector[]) => InputVar[]
}
@@ -76,7 +76,7 @@ const useSingleRunFormParams = ({
}, [runResult, loopRunResult, t])
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
diff --git a/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts b/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
index e6c4b6d3d13..19df911c6ff 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
@@ -42,7 +42,7 @@ const useSingleRunFormParams = ({
const visionFiles = runInputData['#files#']
const setVisionFiles = useCallback(
- (newFiles: any[]) => {
+ (newFiles: unknown[]) => {
setRunInputData?.({
...runInputDataRef.current,
'#files#': newFiles,
@@ -64,7 +64,7 @@ const useSingleRunFormParams = ({
})()
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
const newVars = {
...newPayload,
'#context#': runInputDataRef.current['#context#'],
@@ -120,7 +120,7 @@ const useSingleRunFormParams = ({
},
],
values: { '#files#': visionFiles },
- onChange: (keyValue) => setVisionFiles((keyValue as any)['#files#']),
+ onChange: (keyValue) => setVisionFiles(keyValue['#files#']),
})
}
diff --git a/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts b/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
index f8c210f34f0..ad8c84d56f5 100644
--- a/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
@@ -42,7 +42,7 @@ const useSingleRunFormParams = ({
const visionFiles = runInputData['#files#']
const setVisionFiles = useCallback(
- (newFiles: any[]) => {
+ (newFiles: unknown[]) => {
setRunInputData?.({
...runInputDataRef.current,
'#files#': newFiles,
@@ -64,7 +64,7 @@ const useSingleRunFormParams = ({
})()
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
const newVars = {
...newPayload,
'#files#': runInputDataRef.current['#files#'],
diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.ts
index 5297a527d6f..6825794e05a 100644
--- a/web/app/components/workflow/nodes/start/use-config.ts
+++ b/web/app/components/workflow/nodes/start/use-config.ts
@@ -45,7 +45,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
}
}
- const newInputs = produce(inputs, (draft: any) => {
+ const newInputs = produce(inputs, (draft) => {
draft.variables = newList
})
setInputs(newInputs)
diff --git a/web/app/components/workflow/nodes/template-transform/use-config.ts b/web/app/components/workflow/nodes/template-transform/use-config.ts
index 32a2ba6153e..e04d2571b67 100644
--- a/web/app/components/workflow/nodes/template-transform/use-config.ts
+++ b/web/app/components/workflow/nodes/template-transform/use-config.ts
@@ -35,7 +35,7 @@ const useConfig = (id: string, payload: TemplateTransformNodeType) => {
const handleVarListChange = useCallback(
(newList: Variable[]) => {
- const newInputs = produce(inputsRef.current, (draft: any) => {
+ const newInputs = produce(inputsRef.current, (draft) => {
draft.variables = newList
})
setInputs(newInputs)
@@ -45,7 +45,7 @@ const useConfig = (id: string, payload: TemplateTransformNodeType) => {
const handleAddVariable = useCallback(
(payload: Variable) => {
- const newInputs = produce(inputsRef.current, (draft: any) => {
+ const newInputs = produce(inputsRef.current, (draft) => {
draft.variables.push(payload)
})
setInputs(newInputs)
@@ -56,7 +56,7 @@ const useConfig = (id: string, payload: TemplateTransformNodeType) => {
// rename var in code
const handleVarNameChange = useCallback(
(oldName: string, newName: string) => {
- const newInputs = produce(inputsRef.current, (draft: any) => {
+ const newInputs = produce(inputsRef.current, (draft) => {
draft.template = draft.template.replaceAll(`{{ ${oldName} }}`, `{{ ${newName} }}`)
})
setInputs(newInputs)
@@ -78,7 +78,7 @@ const useConfig = (id: string, payload: TemplateTransformNodeType) => {
const handleCodeChange = useCallback(
(template: string) => {
- const newInputs = produce(inputsRef.current, (draft: any) => {
+ const newInputs = produce(inputsRef.current, (draft) => {
draft.template = template
})
setInputs(newInputs)
diff --git a/web/app/components/workflow/nodes/template-transform/use-single-run-form-params.ts b/web/app/components/workflow/nodes/template-transform/use-single-run-form-params.ts
index 1758ff85a1b..796eb22daa1 100644
--- a/web/app/components/workflow/nodes/template-transform/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/template-transform/use-single-run-form-params.ts
@@ -7,10 +7,10 @@ import useNodeCrud from '../_base/hooks/use-node-crud'
type Params = {
id: string
payload: TemplateTransformNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({
@@ -24,13 +24,13 @@ const useSingleRunFormParams = ({
const varInputs = toVarInputs(inputs.variables)
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/nodes/tool/default.ts b/web/app/components/workflow/nodes/tool/default.ts
index c14f9ace4f1..f82b0427913 100644
--- a/web/app/components/workflow/nodes/tool/default.ts
+++ b/web/app/components/workflow/nodes/tool/default.ts
@@ -109,7 +109,7 @@ const nodeDefault: NodeDefault<ToolNodeType> = {
getOutputVars(
payload: ToolNodeType,
allPluginInfoList: WorkflowPluginCatalogs,
- _ragVars: any,
+ _ragVars: unknown,
{ schemaTypeDefinitions } = { schemaTypeDefinitions: [] },
) {
const { provider_id, provider_type } = payload
diff --git a/web/app/components/workflow/nodes/tool/hooks/use-config.ts b/web/app/components/workflow/nodes/tool/hooks/use-config.ts
index df389818d35..28cf59d6129 100644
--- a/web/app/components/workflow/nodes/tool/hooks/use-config.ts
+++ b/web/app/components/workflow/nodes/tool/hooks/use-config.ts
@@ -62,11 +62,11 @@ const useConfig = (id: string, payload: ToolNodeType) => {
return currTool ? toolParametersToFormSchemas(currTool.parameters) : []
}, [currTool])
const toolInputVarSchema = useMemo(() => {
- return formSchemas.filter((item: any) => item.form === 'llm')
+ return formSchemas.filter((item) => item.form === 'llm')
}, [formSchemas])
// use setting
const toolSettingSchema = useMemo(() => {
- return formSchemas.filter((item: any) => item.form !== 'llm')
+ return formSchemas.filter((item) => item.form !== 'llm')
}, [formSchemas])
const hasShouldTransferTypeSettingInput = toolSettingSchema.some(
(item) => item.type === 'boolean' || item.type === 'number-input',
diff --git a/web/app/components/workflow/nodes/trigger-plugin/node.tsx b/web/app/components/workflow/nodes/trigger-plugin/node.tsx
index 2728b4a6c43..51885244116 100644
--- a/web/app/components/workflow/nodes/trigger-plugin/node.tsx
+++ b/web/app/components/workflow/nodes/trigger-plugin/node.tsx
@@ -9,7 +9,7 @@ import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/compo
import { useNodePluginInstallation } from '../../hooks/use-node-plugin-installation'
import useConfig from './use-config'
-const formatConfigValue = (rawValue: any): string => {
+const formatConfigValue = (rawValue: unknown): string => {
if (rawValue === null || rawValue === undefined) return ''
if (typeof rawValue === 'string' || typeof rawValue === 'number' || typeof rawValue === 'boolean')
@@ -18,7 +18,7 @@ const formatConfigValue = (rawValue: any): string => {
if (Array.isArray(rawValue)) return rawValue.join('.')
if (typeof rawValue === 'object') {
- const { value } = rawValue as { value?: any }
+ const { value } = rawValue as { value?: unknown }
if (value === null || value === undefined) return ''
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
return String(value)
diff --git a/web/app/components/workflow/nodes/trigger-schedule/default.ts b/web/app/components/workflow/nodes/trigger-schedule/default.ts
index d3fd7e8f776..e7e3e214e80 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/default.ts
+++ b/web/app/components/workflow/nodes/trigger-schedule/default.ts
@@ -25,14 +25,20 @@ const isValidTimeFormat = (time: string): boolean => {
)
}
-const validateHourlyConfig = (config: any, t: TFunction<['workflow']>): string => {
+const validateHourlyConfig = (
+ config: NonNullable<ScheduleTriggerNodeType['visual_config']>,
+ t: TFunction<['workflow']>,
+): string => {
if (config.on_minute === undefined || config.on_minute < 0 || config.on_minute > 59)
return t(($) => $['nodes.triggerSchedule.invalidOnMinute'], { ns: 'workflow' })
return ''
}
-const validateDailyConfig = (config: any, t: TFunction<['workflow']>): string => {
+const validateDailyConfig = (
+ config: NonNullable<ScheduleTriggerNodeType['visual_config']>,
+ t: TFunction<['workflow']>,
+): string => {
const i18nPrefix = 'errorMsg'
if (!config.time)
@@ -47,7 +53,10 @@ const validateDailyConfig = (config: any, t: TFunction<['workflow']>): string =>
return ''
}
-const validateWeeklyConfig = (config: any, t: TFunction<['workflow']>): string => {
+const validateWeeklyConfig = (
+ config: NonNullable<ScheduleTriggerNodeType['visual_config']>,
+ t: TFunction<['workflow']>,
+): string => {
const dailyError = validateDailyConfig(config, t)
if (dailyError) return dailyError
@@ -68,7 +77,10 @@ const validateWeeklyConfig = (config: any, t: TFunction<['workflow']>): string =
return ''
}
-const validateMonthlyConfig = (config: any, t: TFunction<['workflow']>): string => {
+const validateMonthlyConfig = (
+ config: NonNullable<ScheduleTriggerNodeType['visual_config']>,
+ t: TFunction<['workflow']>,
+): string => {
const dailyError = validateDailyConfig(config, t)
if (dailyError) return dailyError
diff --git a/web/app/components/workflow/nodes/variable-assigner/use-single-run-form-params.ts b/web/app/components/workflow/nodes/variable-assigner/use-single-run-form-params.ts
index 24a0b4805c3..c5e905234f8 100644
--- a/web/app/components/workflow/nodes/variable-assigner/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/variable-assigner/use-single-run-form-params.ts
@@ -6,10 +6,10 @@ import { useCallback } from 'react'
type Params = {
id: string
payload: VariableAssignerNodeType
- runInputData: Record<string, any>
- runInputDataRef: RefObject<Record<string, any>>
+ runInputData: Record<string, unknown>
+ runInputDataRef: RefObject<Record<string, unknown>>
getInputVars: (textList: string[]) => InputVar[]
- setRunInputData: (data: Record<string, any>) => void
+ setRunInputData: (data: Record<string, unknown>) => void
toVarInputs: (variables: Variable[]) => InputVar[]
varSelectorsToVarInputs: (variables: ValueSelector[]) => InputVar[]
}
@@ -20,13 +20,13 @@ const useSingleRunFormParams = ({
varSelectorsToVarInputs,
}: Params) => {
const setInputVarValues = useCallback(
- (newPayload: Record<string, any>) => {
+ (newPayload: Record<string, unknown>) => {
setRunInputData(newPayload)
},
[setRunInputData],
)
const inputVarValues = (() => {
- const vars: Record<string, any> = {}
+ const vars: Record<string, unknown> = {}
Object.keys(runInputData).forEach((key) => {
vars[key] = runInputData[key]
})
diff --git a/web/app/components/workflow/panel/chat-record/user-input.tsx b/web/app/components/workflow/panel/chat-record/user-input.tsx
index bcc9e880516..3889bf236d4 100644
--- a/web/app/components/workflow/panel/chat-record/user-input.tsx
+++ b/web/app/components/workflow/panel/chat-record/user-input.tsx
@@ -33,7 +33,7 @@ const UserInput = ({ variables = [], initialExpanded = true }: UserInputProps) =
<div className="px-2 pt-1 pb-3">
{expanded && (
<div className="py-2 text-[13px] text-text-primary">
- {variables.map((variable: any) => (
+ {variables.map((variable) => (
<div key={variable.variable} className="mb-2 last-of-type:mb-0"></div>
))}
</div>
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
index 4dc73ec3d4d..90bed42d735 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
@@ -22,7 +22,7 @@ const ArrayValueList: FC<Props> = ({ className, list, onChange }) => {
const handleChange = useCallback(
(index: number) => {
return (value: boolean) => {
- const newList = produce(list, (draft: any[]) => {
+ const newList = produce(list, (draft) => {
draft[index] = value
})
onChange(newList)
@@ -44,7 +44,7 @@ const ArrayValueList: FC<Props> = ({ className, list, onChange }) => {
)
const handleItemAdd = useCallback(() => {
- const newList = produce(list, (draft: any[]) => {
+ const newList = produce(list, (draft) => {
draft.push(false)
})
onChange(newList)
diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts
index 3f67e3ca113..d024aec36c6 100644
--- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts
+++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts
@@ -741,7 +741,7 @@ export const useChat = (
onData: (
message: string,
_isFirstMessage: boolean,
- { conversationId: newConversationId, messageId: msgId, taskId }: any,
+ { conversationId: newConversationId, messageId: msgId, taskId },
) => {
updateChatTreeNode(messageId, (responseItem) => {
responseItem.content = responseItem.content + message
diff --git a/web/app/components/workflow/utils/node-navigation.ts b/web/app/components/workflow/utils/node-navigation.ts
index 2d85faf8c03..d71669ae7b3 100644
--- a/web/app/components/workflow/utils/node-navigation.ts
+++ b/web/app/components/workflow/utils/node-navigation.ts
@@ -1,3 +1,5 @@
+import type { Node, ReactFlowInstance } from 'reactflow'
+
/**
* Node navigation utilities for workflow
* This module provides functions for node selection, focusing and scrolling in workflow
@@ -77,7 +79,10 @@ export function setupNodeSelectionListener(handleNodeSelect: (nodeId: string) =>
* @param reactflow - The ReactFlow instance
* @returns Cleanup function
*/
-export function setupScrollToNodeListener(nodes: any[], reactflow: any): () => void {
+export function setupScrollToNodeListener(
+ nodes: Pick<Node, 'id' | 'position'>[],
+ reactflow: Pick<ReactFlowInstance, 'setCenter'>,
+): () => void {
// Event handler for scrolling to node
const handleScrollToNode = (event: CustomEvent<NodeSelectionDetail>) => {
const { nodeId } = event.detail
diff --git a/web/app/reset-password/layout.tsx b/web/app/reset-password/layout.tsx
index 5fa253d0357..c0f876f1eef 100644
--- a/web/app/reset-password/layout.tsx
+++ b/web/app/reset-password/layout.tsx
@@ -5,6 +5,6 @@ export function generateMetadata() {
return getRouteMetadata('login', ($) => $.resetPassword)
}
-export default function SignInLayout({ children }: any) {
+export default function SignInLayout({ children }: { children: React.ReactNode }) {
return <ResetPasswordLayout>{children}</ResetPasswordLayout>
}
diff --git a/web/app/signin/layout.tsx b/web/app/signin/layout.tsx
index b1eb5541c67..385c9faf96a 100644
--- a/web/app/signin/layout.tsx
+++ b/web/app/signin/layout.tsx
@@ -4,7 +4,7 @@ import { useSuspenseQuery } from '@tanstack/react-query'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import Header from './_header'
-export default function SignInLayout({ children }: any) {
+export default function SignInLayout({ children }: { children: React.ReactNode }) {
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
return (
<>
diff --git a/web/app/signup/layout.tsx b/web/app/signup/layout.tsx
index 3bd497c8317..faf0c054fd2 100644
--- a/web/app/signup/layout.tsx
+++ b/web/app/signup/layout.tsx
@@ -5,6 +5,6 @@ export function generateMetadata() {
return getRouteMetadata('login', ($) => $['signup.createAccount'])
}
-export default function RegisterLayout({ children }: any) {
+export default function RegisterLayout({ children }: { children: React.ReactNode }) {
return <SignupLayout>{children}</SignupLayout>
}
diff --git a/web/hooks/use-mitt.ts b/web/hooks/use-mitt.ts
index c1b0e0388f5..c150ca9a5ba 100644
--- a/web/hooks/use-mitt.ts
+++ b/web/hooks/use-mitt.ts
@@ -2,7 +2,7 @@ import type { Emitter, EventType, Handler, WildcardHandler } from 'mitt'
import create from 'mitt'
import { useCallback, useEffect, useRef, useState } from 'react'
-const merge = <T extends Record<string, any>>(...args: Array<T | undefined>): T => {
+const merge = <T extends object>(...args: Array<T | undefined>): T => {
return Object.assign({}, ...args)
}
diff --git a/web/models/pipeline.ts b/web/models/pipeline.ts
index 66341e92521..3acdc4e45d4 100644
--- a/web/models/pipeline.ts
+++ b/web/models/pipeline.ts
@@ -82,7 +82,7 @@ export type RAGPipelineVariables = RAGPipelineVariable[]
export type PipelineExecutionLogResponse = {
datasource_info: Record<string, any>
datasource_type: DatasourceType
- input_data: Record<string, any>
+ input_data: Record<string, unknown>
datasource_node_id: string
}
diff --git a/web/service/common.ts b/web/service/common.ts
index 937202cbcac..acd61f56359 100644
--- a/web/service/common.ts
+++ b/web/service/common.ts
@@ -17,7 +17,7 @@ export const webAppLogin = ({
body,
}: {
url: string
- body: Record<string, any>
+ body: Record<string, unknown>
}): Promise<LoginResponse> => {
return post<LoginResponse>(url, { body }, { isPublicAPI: true })
}
diff --git a/web/service/debug.ts b/web/service/debug.ts
index 375d2db0b01..4140313ddf4 100644
--- a/web/service/debug.ts
+++ b/web/service/debug.ts
@@ -50,7 +50,7 @@ export const stopChatMessageResponding = async (appId: string, taskId: string) =
export const sendCompletionMessage = async (
appId: string,
- body: Record<string, any>,
+ body: Record<string, unknown>,
handlers: {
onData: IOnData
onCompleted: IOnCompleted
diff --git a/web/service/fetch.ts b/web/service/fetch.ts
index ecad85e0677..67b4e0e57ce 100644
--- a/web/service/fetch.ts
+++ b/web/service/fetch.ts
@@ -32,8 +32,8 @@ export const ContentType = {
}
export type FetchOptionType = Omit<RequestInit, 'body'> & {
- params?: Record<string, any>
- body?: BodyInit | Record<string, any> | null
+ params?: Record<string, string | number | boolean | undefined>
+ body?: BodyInit | Record<string, unknown> | null
}
const afterResponse204: AfterResponseHook = async ({ response }) => {
diff --git a/web/service/share.ts b/web/service/share.ts
index a446c3ddde7..05488d01d66 100644
--- a/web/service/share.ts
+++ b/web/service/share.ts
@@ -73,7 +73,7 @@ export const stopChatMessageResponding = async (
}
export const sendCompletionMessage = async (
- body: Record<string, any>,
+ body: Record<string, unknown>,
{
onData,
onCompleted,
@@ -110,7 +110,7 @@ export const sendCompletionMessage = async (
}
export const sendWorkflowMessage = async (
- body: Record<string, any>,
+ body: Record<string, unknown>,
otherOptions: IOtherOptions,
appSourceType: AppSourceType,
appId = '',
diff --git a/web/service/use-plugins-auth.ts b/web/service/use-plugins-auth.ts
index a991a37775f..6bc2180f2a2 100644
--- a/web/service/use-plugins-auth.ts
+++ b/web/service/use-plugins-auth.ts
@@ -37,7 +37,7 @@ export const useSetPluginDefaultCredential = (url: string) => {
export const useAddPluginCredential = (url: string) => {
return useMutation({
mutationFn: (params: {
- credentials: Record<string, any>
+ credentials: Record<string, unknown>
type: CredentialTypeEnum
name?: string
visibility?: string
@@ -52,7 +52,7 @@ export const useUpdatePluginCredential = (url: string) => {
return useMutation({
mutationFn: (params: {
credential_id: string
- credentials?: Record<string, any>
+ credentials?: Record<string, unknown>
name?: string
visibility?: string
partial_member_list?: Array<{ user_id: string }>
@@ -101,7 +101,7 @@ export const useGetPluginOAuthClientSchema = (url: string) => {
schema: FormSchema[]
is_oauth_custom_client_enabled: boolean
is_system_oauth_params_exists?: boolean
- client_params?: Record<string, any>
+ client_params?: Record<string, unknown>
redirect_uri?: string
}>(url),
staleTime: 0,
@@ -115,7 +115,7 @@ export const useInvalidPluginOAuthClientSchema = (url: string) => {
export const useSetPluginOAuthCustomClient = (url: string) => {
return useMutation({
mutationFn: (params: {
- client_params: Record<string, any>
+ client_params: Record<string, unknown>
enable_oauth_custom_client: boolean
}) => {
return post<{ result: string }>(url, { body: params })
diff --git a/web/service/use-workflow.ts b/web/service/use-workflow.ts
index 539594101d1..7f89c69cb19 100644
--- a/web/service/use-workflow.ts
+++ b/web/service/use-workflow.ts
@@ -568,7 +568,7 @@ export const useTestEmailSender = () => {
appID: string
nodeID: string
deliveryID: string
- inputs: Record<string, any>
+ inputs: Record<string, unknown>
}) => {
const { appID, nodeID, deliveryID, inputs } = data
return consoleClient.apps.byAppId.workflows.draft.humanInput.nodes.byNodeId.deliveryTest.post(
diff --git a/web/types/pipeline.tsx b/web/types/pipeline.tsx
index bc69afdbd18..841d62f9677 100644
--- a/web/types/pipeline.tsx
+++ b/web/types/pipeline.tsx
@@ -15,7 +15,7 @@ export type OnlineDriveData = {
bucket: string
files: OnlineDriveFile[]
is_truncated: boolean
- next_page_parameters: Record<string, any>
+ next_page_parameters: Record<string, unknown>
}
export type DataSourceNodeCompletedResponse = {
diff --git a/web/utils/gtag.ts b/web/utils/gtag.ts
index 2a79df0105d..cd089428e05 100644
--- a/web/utils/gtag.ts
+++ b/web/utils/gtag.ts
@@ -6,8 +6,8 @@ import { isServer } from '@/utils/client'
* @param eventParams - event params
*/
export const sendGAEvent = (eventName: string, eventParams?: GtagEventParams): void => {
- if (isServer || typeof (window as any).gtag !== 'function') {
+ if (isServer || typeof window.gtag !== 'function') {
return
}
- ;(window as any).gtag('event', eventName, eventParams)
+ window.gtag('event', eventName, eventParams)
}
diff --git a/web/utils/index.ts b/web/utils/index.ts
index a0234e0aac5..fedf348be63 100644
--- a/web/utils/index.ts
+++ b/web/utils/index.ts
@@ -4,7 +4,7 @@ export const sleep = (ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms))
}
-export async function asyncRunSafe<T = any>(fn: Promise<T>): Promise<[Error] | [null, T]> {
+export async function asyncRunSafe<T>(fn: Promise<T>): Promise<[Error] | [null, T]> {
try {
return [null, await fn]
} catch (e: any) {
@@ -30,10 +30,7 @@ export const getPurifyHref = (href: string) => {
return escape(href)
}
-export async function fetchWithRetry<T = any>(
- fn: Promise<T>,
- retries = 3,
-): Promise<[Error] | [null, T]> {
+export async function fetchWithRetry<T>(fn: Promise<T>, retries = 3): Promise<[Error] | [null, T]> {
const [error, res] = await asyncRunSafe(fn)
if (error) {
if (retries > 0) {