File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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' , '' )
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 ):
You can’t perform that action at this time.
0 commit comments