Skip to content

Commit 93e79ff

Browse files
committed
fix(tui-v2): preserve new conversation when switching with /continue
1 parent e87f9e7 commit 93e79ff

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

frontends/continue_cmd.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,13 @@ def _current_log_path(pid=None):
322322
return os.path.join(_LOG_DIR, f'model_responses_{pid}.txt')
323323

324324

325-
def _snapshot_current_log(pid=None):
326-
"""Persist current PID log as a standalone recoverable snapshot, then clear it."""
327-
path = _current_log_path(pid)
325+
def _snapshot_current_log(pid=None, agent=None):
326+
"""Persist the active log as a recoverable snapshot, then clear it."""
327+
path = ''
328+
if agent is not None:
329+
path = getattr(agent, 'log_path', '') or getattr(getattr(agent, 'llmclient', None), 'log_path', '')
330+
if not path:
331+
path = _current_log_path(pid)
328332
if not os.path.isfile(path):
329333
return None
330334
try:
@@ -351,7 +355,7 @@ def reset_conversation(agent, message='🆕 已开启新对话,当前上下文
351355
agent.abort()
352356
except Exception:
353357
pass
354-
_snapshot_current_log()
358+
_snapshot_current_log(agent=agent)
355359
if hasattr(agent, 'history'):
356360
agent.history = []
357361
for client in _agent_clients(agent):

0 commit comments

Comments
 (0)