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
This commit is contained in:
@@ -1540,7 +1540,7 @@ def create_app(args):
|
|||||||
|
|
||||||
# 判断是否包含特定字符串,使用正则表达式进行匹配
|
# 判断是否包含特定字符串,使用正则表达式进行匹配
|
||||||
logging.info(f"Cleaned query content: {cleaned_query}")
|
logging.info(f"Cleaned query content: {cleaned_query}")
|
||||||
match_result = re.search(r'\\n<chat_history>\\nUSER:', cleaned_query)
|
match_result = re.search(r'\n<chat_history>\nUSER:', cleaned_query, re.MULTILINE)
|
||||||
logging.info(f"Regex match result: {bool(match_result)}")
|
logging.info(f"Regex match result: {bool(match_result)}")
|
||||||
|
|
||||||
if match_result:
|
if match_result:
|
||||||
|
Reference in New Issue
Block a user