yangdx
commited on
Commit
·
4a5fb8c
1
Parent(s):
c1cfa92
Fix regex pattern for chat history detection
Browse files- 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
CHANGED
@@ -1540,7 +1540,7 @@ def create_app(args):
|
|
1540 |
|
1541 |
# 判断是否包含特定字符串,使用正则表达式进行匹配
|
1542 |
logging.info(f"Cleaned query content: {cleaned_query}")
|
1543 |
-
match_result = re.search(r'
|
1544 |
logging.info(f"Regex match result: {bool(match_result)}")
|
1545 |
|
1546 |
if match_result:
|
|
|
1540 |
|
1541 |
# 判断是否包含特定字符串,使用正则表达式进行匹配
|
1542 |
logging.info(f"Cleaned query content: {cleaned_query}")
|
1543 |
+
match_result = re.search(r'\n<chat_history>\nUSER:', cleaned_query, re.MULTILINE)
|
1544 |
logging.info(f"Regex match result: {bool(match_result)}")
|
1545 |
|
1546 |
if match_result:
|