fix: /resume normalize literal \n to real newlines before regex matching

This commit is contained in:
Liang Jiaqing committed 2026-04-28 09:38:04 +08:00
1 parent 3e57ec07f5
commit 86ac99c9dc
1 file changed
+1 -1
+1 -1
View File
@@ -121,7 +121,7 @@ class GeneraticAgent:
display_queue.put({'done': smart_format(f"✅ session.{k} = {repr(v)}", max_str_len=500), 'source': 'system'})
return None
if raw_query.strip() == '/resume':
return r'用re.findall(r"<history>\\n\[(?:USER\|Agent)\].*?</history>", content, re.DOTALL) 扫temp/model_responses/下时间最近的10个文件(除本PID),取每文件最后一个匹配(注意JSON里换行是字面\\n)作为该会话内容,按mtime倒序,每个用一句话总结聊了什么让我选择;选定后再简单读该文件末尾作为聊天基础'
return r'扫temp/model_responses/下时间最近的10个文件(除本PID),读取每个文件content后先replace("\\n","\n").replace("\\r","\r")统一为真换行,再用re.findall(r"<history>\n\[(?:USER|Agent)\].*?</history>", content, re.DOTALL)提取,取每文件最后一个匹配作为该会话内容,按mtime倒序,每个用一句话总结聊了什么让我选择;选定后再简单读该文件末尾作为聊天基础'
return raw_query
def run(self):