Fix logging filter logic

• Fix boolean operator precedence in filter
• Consolidate GET/POST condition logic
This commit is contained in:
yangdx 2025-09-26 19:42:33 +08:00
parent 3ba06478a8
commit a528213210
2 changed files with 2 additions and 4 deletions

View file

@ -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) result = await rag.aquery_llm(request.query, param=param)
async def stream_generator(): async def stream_generator():
# Extract references and LLM response from unified result # Extract references and LLM response from unified result
references = result.get("data", {}).get("references", []) references = result.get("data", {}).get("references", [])
llm_response = result.get("llm_response", {}) llm_response = result.get("llm_response", {})

View file

@ -230,10 +230,9 @@ class LightragPathFilter(logging.Filter):
path = record.args[2] path = record.args[2]
status = record.args[4] status = record.args[4]
# Filter out successful GET requests to filtered paths # Filter out successful GET/POST requests to filtered paths
if ( if (
method == "GET" (method == "GET" or method == "POST")
or method == "POST"
and (status == 200 or status == 304) and (status == 200 or status == 304)
and path in self.filtered_paths and path in self.filtered_paths
): ):