From 341e5904c847948d13e339f7df6aacd67ab8b652 Mon Sep 17 00:00:00 2001 From: Yongteng Lei Date: Tue, 18 Nov 2025 15:42:31 +0800 Subject: [PATCH] Fix: No results can be found through the API /api/v1/dify/retrieval (#11338) ### What problem does this PR solve? No results can be found through the API /api/v1/dify/retrieval. #11307 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/dify_retrieval.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/apps/sdk/dify_retrieval.py b/api/apps/sdk/dify_retrieval.py index d2c3485a9..e02875820 100644 --- a/api/apps/sdk/dify_retrieval.py +++ b/api/apps/sdk/dify_retrieval.py @@ -131,12 +131,10 @@ def retrieval(tenant_id): return build_error_result(message="Knowledgebase not found!", code=RetCode.NOT_FOUND) embd_mdl = LLMBundle(kb.tenant_id, LLMType.EMBEDDING.value, llm_name=kb.embd_id) - print(metadata_condition) - # print("after", convert_conditions(metadata_condition)) - doc_ids.extend(meta_filter(metas, convert_conditions(metadata_condition))) - # print("doc_ids", doc_ids) - if not doc_ids and metadata_condition is not None: - doc_ids = ['-999'] + if metadata_condition: + doc_ids.extend(meta_filter(metas, convert_conditions(metadata_condition))) + if not doc_ids and metadata_condition: + doc_ids = ["-999"] ranks = settings.retriever.retrieval( question, embd_mdl,