From dad041c49f2450163e874a31b52b56ee9f591e18 Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:25:00 +0800 Subject: [PATCH] fix issue: query is none when doing retrieval (#10129) --- api/core/rag/datasource/retrieval_service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/core/rag/datasource/retrieval_service.py b/api/core/rag/datasource/retrieval_service.py index 3affbd2d0a..57af05861c 100644 --- a/api/core/rag/datasource/retrieval_service.py +++ b/api/core/rag/datasource/retrieval_service.py @@ -34,6 +34,8 @@ class RetrievalService: reranking_mode: Optional[str] = "reranking_model", weights: Optional[dict] = None, ): + if not query: + return [] dataset = db.session.query(Dataset).filter(Dataset.id == dataset_id).first() if not dataset: return []