update knowledge base api (#20426)

This commit is contained in:
Dongyu Li 2025-05-30 14:45:30 +08:00 committed by GitHub
commit 1ea4459d9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 397 additions and 36 deletions

View file

@ -937,6 +937,9 @@ class DatasetRetrieval:
return metadata_filter_document_ids, metadata_condition
def _replace_metadata_filter_value(self, text: str, inputs: dict) -> str:
if not inputs:
return text
def replacer(match):
key = match.group(1)
return str(inputs.get(key, f"{{{{{key}}}}}"))