From 5be22458301fa478f9f7aa538f2bfc316a9f7027 Mon Sep 17 00:00:00 2001 From: DawnARC Date: Sat, 9 May 2026 01:04:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=BA=A0=E6=AD=A3=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/A_memorix/core/utils/search_execution_service.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/A_memorix/core/utils/search_execution_service.py b/src/A_memorix/core/utils/search_execution_service.py index f6f6b145..651ff417 100644 --- a/src/A_memorix/core/utils/search_execution_service.py +++ b/src/A_memorix/core/utils/search_execution_service.py @@ -287,8 +287,11 @@ class SearchExecutionService: ) async def _executor() -> Dict[str, Any]: - original_ppr = bool(retriever.config.enable_ppr) - retriever.config.enable_ppr = bool(request.enable_ppr) + retriever_config = getattr(retriever, "config", None) + has_runtime_ppr_switch = retriever_config is not None and hasattr(retriever_config, "enable_ppr") + original_ppr = bool(retriever_config.enable_ppr) if has_runtime_ppr_switch else None + if has_runtime_ppr_switch: + retriever_config.enable_ppr = bool(request.enable_ppr) started_at = time.time() try: retrieved = await retriever.retrieve( @@ -381,7 +384,8 @@ class SearchExecutionService: elapsed_ms = (time.time() - started_at) * 1000.0 return {"results": retrieved, "elapsed_ms": elapsed_ms} finally: - retriever.config.enable_ppr = original_ppr + if has_runtime_ppr_switch: + retriever_config.enable_ppr = bool(original_ppr) dedup_hit = False try: