From d32fa02d9781645c5252e38b75d4c0317c224574 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 14 Jan 2026 11:45:31 +0800 Subject: [PATCH] Fix: Unable to copy category node. #12607 (#12609) ### What problem does this PR solve? Fix: Unable to copy category node. #12607 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/pages/agent/utils.ts | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/web/src/pages/agent/utils.ts b/web/src/pages/agent/utils.ts index 1837ed218..68938982b 100644 --- a/web/src/pages/agent/utils.ts +++ b/web/src/pages/agent/utils.ts @@ -362,14 +362,30 @@ function transformRequestSchemaToJsonschema( function transformBeginParams(params: BeginFormSchemaType) { if (params.mode === AgentDialogueMode.Webhook) { - const nextSecurity: Record = { - ...params.security, + const security = params.security; + const nextSecurity: Omit< + NonNullable, + 'ip_whitelist' | 'jwt' + > & { + ip_whitelist?: string[]; + jwt?: Omit< + NonNullable['jwt'], + 'required_claims' + > & { + required_claims?: string[]; + }; + } = { + ...((security ?? {}) as Omit< + NonNullable, + 'ip_whitelist' | 'jwt' + >), ip_whitelist: params.security?.ip_whitelist.map((x) => x.value), }; + if (params.security?.auth_type === WebhookSecurityAuthType.Jwt) { nextSecurity.jwt = { - ...nextSecurity.jwt, - required_claims: nextSecurity.jwt?.required_claims.map((x) => x.value), + ...security?.jwt, + required_claims: security?.jwt?.required_claims.map((x) => x.value), }; } return { @@ -463,8 +479,8 @@ export const buildDslGlobalVariables = ( return { globals: dsl.globals, variables: dsl.variables || {} }; } - let globalVariablesTemp: Record = {}; - let globalSystem: Record = {}; + const globalVariablesTemp: Record = {}; + const globalSystem: Record = {}; Object.keys(dsl.globals)?.forEach((key) => { if (key.indexOf('sys') > -1) { globalSystem[key] = dsl.globals[key]; @@ -633,9 +649,9 @@ export const duplicateNodeForm = (nodeData?: RAGFlowNodeType['data']) => { // Delete the downstream node corresponding to the to field of the Categorize operator if (nodeData?.label === Operator.Categorize) { - form.category_description = Object.keys(form.category_description).reduce< - Record> - >((pre, cur) => { + form.category_description = Object.keys( + form?.category_description ?? {}, + ).reduce>>((pre, cur) => { pre[cur] = { ...form.category_description[cur], to: undefined,