improve /resume: use regex to extract history blocks instead of naive tail reading
This commit is contained in:
@@ -109,7 +109,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 '简单看看model_responses中的最近几次对话结尾部分(除了本次),分别简单总结一下让我选择,然后你简单阅读了解情况后作为我们接下来聊天的基础'
|
||||
return r'用re.findall(r"<history>\\n\[(?:USER\|Agent)\].*?</history>", content, re.DOTALL) 扫temp/model_responses/下各文件(除本PID),取每文件最后一个匹配(注意JSON里换行是字面\\n)作为该会话内容,按mtime倒序,每个用一句话总结聊了什么让我选择;选定后再简单读该文件末尾作为聊天基础'
|
||||
return raw_query
|
||||
|
||||
def run(self):
|
||||
|
||||
Reference in New Issue
Block a user