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
check metadata_filtering_conditions could be None in auto mode (#18548)
Jyonge2cb7006c4c6
diff --git a/api/core/rag/retrieval/dataset_retrieval.py b/api/core/rag/retrieval/dataset_retrieval.pyindex 23ea775dece..4869a21e80c 100644--- a/api/core/rag/retrieval/dataset_retrieval.py+++ b/api/core/rag/retrieval/dataset_retrieval.py@@ -869,7 +869,9 @@ class DatasetRetrieval:))metadata_condition = MetadataCondition(- logical_operator=metadata_filtering_conditions.logical_operator, # type: ignore+ logical_operator=metadata_filtering_conditions.logical_operator+ if metadata_filtering_conditions+ else "or", # type: ignoreconditions=conditions,)elif metadata_filtering_mode == "manual":@@ -891,10 +893,10 @@ class DatasetRetrieval:else:raise ValueError("Invalid metadata filtering mode")if filters:- if metadata_filtering_conditions.logical_operator == "or": # type: ignore- document_query = document_query.filter(or_(*filters))- else:+ if metadata_filtering_conditions and metadata_filtering_conditions.logical_operator == "and": # type: ignoredocument_query = document_query.filter(and_(*filters))+ else:+ document_query = document_query.filter(or_(*filters))documents = document_query.all()# group by dataset_idmetadata_filter_document_ids = defaultdict(list) if documents else None # type: ignorediff --git a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.pyindex 07a711cc4ea..4ec033572c3 100644--- a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py+++ b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py@@ -349,7 +349,9 @@ class KnowledgeRetrievalNode(LLMNode):))metadata_condition = MetadataCondition(- logical_operator=node_data.metadata_filtering_conditions.logical_operator, # type: ignore+ logical_operator=node_data.metadata_filtering_conditions.logical_operator+ if node_data.metadata_filtering_conditions+ else "or", # type: ignoreconditions=conditions,)elif node_data.metadata_filtering_mode == "manual":@@ -380,7 +382,10 @@ class KnowledgeRetrievalNode(LLMNode):else:raise ValueError("Invalid metadata filtering mode")if filters:- if node_data.metadata_filtering_conditions.logical_operator == "and": # type: ignore+ if (+ node_data.metadata_filtering_conditions+ and node_data.metadata_filtering_conditions.logical_operator == "and"+ ): # type: ignoredocument_query = document_query.filter(and_(*filters))else:document_query = document_query.filter(or_(*filters))