pull/20874/merge
yg2024 7 months ago committed by GitHub
commit 111c0f757e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -148,6 +148,8 @@ SupportedComparisonOperator = Literal[
"is not",
"empty",
"not empty",
"in",
"not in",
# for number
"=",
"",

@ -13,6 +13,8 @@ SupportedComparisonOperator = Literal[
"is not",
"empty",
"not empty",
"in",
"not in",
# for number
"=",
"",

@ -74,6 +74,8 @@ SupportedComparisonOperator = Literal[
"is not",
"empty",
"not empty",
"in",
"not in",
# for number
"=",
"",

@ -603,6 +603,18 @@ class KnowledgeRetrievalNode(BaseNode):
**{key: metadata_name, key_value: f"%{value}"}
)
)
case "in":
filters.append(
(text(f"documents.doc_metadata ->> :{key} = any(string_to_array(:{key_value},',')")).params(
**{key: metadata_name, key_value: f"{value}"}
)
)
case "not in":
filters.append(
(text(f"documents.doc_metadata ->> :{key} != all(string_to_array(:{key_value},',')")).params(
**{key: metadata_name, key_value: f"{value}"}
)
)
case "=" | "is":
if isinstance(value, str):
filters.append(Document.doc_metadata[metadata_name] == f'"{value}"')

@ -32,6 +32,8 @@ export const getOperators = (type?: MetadataFilteringVariableType) => {
ComparisonOperator.endWith,
ComparisonOperator.empty,
ComparisonOperator.notEmpty,
ComparisonOperator.in,
ComparisonOperator.notIn,
]
case MetadataFilteringVariableType.number:
return [

@ -592,8 +592,8 @@ const translation = {
'not empty': '不为空',
'null': '空',
'not null': '不为空',
'in': '',
'not in': '不',
'in': '',
'not in': '不',
'all of': '全部是',
'exists': '存在',
'not exists': '不存在',

Loading…
Cancel
Save