Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Unable to copy category node. #12607 (#12609)

balibabud32fa02d9781
diff --git a/web/src/pages/agent/utils.ts b/web/src/pages/agent/utils.ts
index 1837ed218c..68938982b3 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<string, any> = {
- ...params.security,
+ const security = params.security;
+ const nextSecurity: Omit<
+ NonNullable<BeginFormSchemaType['security']>,
+ 'ip_whitelist' | 'jwt'
+ > & {
+ ip_whitelist?: string[];
+ jwt?: Omit<
+ NonNullable<BeginFormSchemaType['security']>['jwt'],
+ 'required_claims'
+ > & {
+ required_claims?: string[];
+ };
+ } = {
+ ...((security ?? {}) as Omit<
+ NonNullable<BeginFormSchemaType['security']>,
+ '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<string, any> = {};
- let globalSystem: Record<string, any> = {};
+ const globalVariablesTemp: Record<string, any> = {};
+ const globalSystem: Record<string, any> = {};
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<string, Record<string, any>>
- >((pre, cur) => {
+ form.category_description = Object.keys(
+ form?.category_description ?? {},
+ ).reduce<Record<string, Record<string, any>>>((pre, cur) => {
pre[cur] = {
...form.category_description[cur],
to: undefined,