From 11873625a37dc58937ba03214080683693fa1cef Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 24 Jan 2025 23:39:33 +0800 Subject: [PATCH] Fix regex pattern for chat history detection - Updated regex to match newline characters - Added re.MULTILINE flag for multiline matching - Improved logging for regex match results - Enhanced query content cleaning process - Ensured consistent chat history detection --- lightrag/api/lightrag_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index 93667e84..ab9fe732 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -1540,7 +1540,7 @@ def create_app(args): # 判断是否包含特定字符串,使用正则表达式进行匹配 logging.info(f"Cleaned query content: {cleaned_query}") - match_result = re.search(r'\\n\\nUSER:', cleaned_query) + match_result = re.search(r'\n\nUSER:', cleaned_query, re.MULTILINE) logging.info(f"Regex match result: {bool(match_result)}") if match_result: