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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: fix metadata filter not survive a rename (#30174)
wangxiaoleib892906d714a
diff --git a/web/app/components/app/configuration/dataset-config/index.tsx b/web/app/components/app/configuration/dataset-config/index.tsxindex 2fc82c82b66..f5324f40d87 100644--- a/web/app/components/app/configuration/dataset-config/index.tsx+++ b/web/app/components/app/configuration/dataset-config/index.tsx@@ -176,7 +176,7 @@ const DatasetConfig: FC = () => {}))}, [setDatasetConfigs, datasetConfigsRef])- const handleAddCondition = useCallback<HandleAddCondition>(({ name, type }) => {+ const handleAddCondition = useCallback<HandleAddCondition>(({ id, name, type }) => {let operator: ComparisonOperator = ComparisonOperator.isif (type === MetadataFilteringVariableType.number)@@ -184,6 +184,7 @@ const DatasetConfig: FC = () => {const newCondition = {id: uuid4(),+ metadata_id: id, // Save metadata.id for reliable referencename,comparison_operator: operator,}diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-item.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-item.tsxindex 815844d434c..17fbd8ebca6 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-item.tsx+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-item.tsx@@ -62,8 +62,15 @@ const ConditionItem = ({}, [onRemoveCondition, condition.id])const currentMetadata = useMemo(() => {+ // Try to match by metadata_id first (reliable reference)+ if (condition.metadata_id) {+ const found = metadataList.find(metadata => metadata.id === condition.metadata_id)+ if (found)+ return found+ }+ // Fallback to name matching for backward compatibility with old conditionsreturn metadataList.find(metadata => metadata.name === condition.name)- }, [metadataList, condition.name])+ }, [metadataList, condition.metadata_id, condition.name])const handleConditionOperatorChange = useCallback((operator: ComparisonOperator) => {onUpdateCondition?.(diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsxindex 3a8d96f8f21..82f0decc01b 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx@@ -27,11 +27,17 @@ const MetadataTrigger = ({useEffect(() => {if (selectedDatasetsLoaded) {conditions.forEach((condition) => {- if (!metadataList.find(metadata => metadata.name === condition.name))+ // First try to match by metadata_id for reliable reference+ const foundById = condition.metadata_id && metadataList.find(metadata => metadata.id === condition.metadata_id)+ // Fallback to name matching only for backward compatibility with old conditions+ const foundByName = !condition.metadata_id && metadataList.find(metadata => metadata.name === condition.name)++ // Only remove condition if both metadata_id and name matching fail+ if (!foundById && !foundByName)handleRemoveCondition(condition.id)})}- }, [metadataList, handleRemoveCondition, selectedDatasetsLoaded])+ }, [metadataFilteringConditions, metadataList, handleRemoveCondition, selectedDatasetsLoaded])return (<PortalToFollowElemdiff --git a/web/app/components/workflow/nodes/knowledge-retrieval/types.ts b/web/app/components/workflow/nodes/knowledge-retrieval/types.tsindex 3b62a1e83fc..b28c49bffb3 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/types.ts+++ b/web/app/components/workflow/nodes/knowledge-retrieval/types.ts@@ -86,6 +86,7 @@ export enum MetadataFilteringVariableType {export type MetadataFilteringCondition = {id: stringname: string+ metadata_id?: stringcomparison_operator: ComparisonOperatorvalue?: string | number}diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/use-config.ts b/web/app/components/workflow/nodes/knowledge-retrieval/use-config.tsindex 9a63bf96de6..5208200b252 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/use-config.ts+++ b/web/app/components/workflow/nodes/knowledge-retrieval/use-config.ts@@ -305,7 +305,7 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {}))}, [setInputs])- const handleAddCondition = useCallback<HandleAddCondition>(({ name, type }) => {+ const handleAddCondition = useCallback<HandleAddCondition>(({ id, name, type }) => {let operator: ComparisonOperator = ComparisonOperator.isif (type === MetadataFilteringVariableType.number)@@ -313,6 +313,7 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {const newCondition = {id: uuid4(),+ metadata_id: id, // Save metadata.id for reliable referencename,comparison_operator: operator,}