check metadata_filtering_conditions could be None in auto mode (#18548)
This commit is contained in:
parent
3737e0b087
commit
e2cb7006c4
2 changed files with 13 additions and 6 deletions
|
|
@ -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: ignore
|
||||
conditions=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: ignore
|
||||
document_query = document_query.filter(and_(*filters))
|
||||
else:
|
||||
document_query = document_query.filter(or_(*filters))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue