From a528213210eac4d15618da119b387c842301f37c Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 26 Sep 2025 19:42:33 +0800 Subject: [PATCH] Fix logging filter logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fix boolean operator precedence in filter • Consolidate GET/POST condition logic --- lightrag/api/routers/query_routes.py | 1 - lightrag/utils.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lightrag/api/routers/query_routes.py b/lightrag/api/routers/query_routes.py index 567659f8..d79dbde1 100644 --- a/lightrag/api/routers/query_routes.py +++ b/lightrag/api/routers/query_routes.py @@ -222,7 +222,6 @@ def create_query_routes(rag, api_key: Optional[str] = None, top_k: int = 60): result = await rag.aquery_llm(request.query, param=param) async def stream_generator(): - # Extract references and LLM response from unified result references = result.get("data", {}).get("references", []) llm_response = result.get("llm_response", {}) diff --git a/lightrag/utils.py b/lightrag/utils.py index c72b6fd2..60542e43 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -230,10 +230,9 @@ class LightragPathFilter(logging.Filter): path = record.args[2] status = record.args[4] - # Filter out successful GET requests to filtered paths + # Filter out successful GET/POST requests to filtered paths if ( - method == "GET" - or method == "POST" + (method == "GET" or method == "POST") and (status == 200 or status == 304) and path in self.filtered_paths ):