Save sessions immediately on creation and after context compression

parent 1de9996c
......@@ -608,6 +608,9 @@ class CoderClient:
# Replace with summary
self.conversation_history = [{"role": "system", "content": summary}] + keep
# Save the updated session after compression
self._save_current_session()
def _save_current_session(self):
"""Save current session if it has a name."""
......@@ -643,6 +646,9 @@ class CoderClient:
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
self.session_name = f"session_{timestamp}"
# Save the new empty session immediately
self._save_current_session()
return self.session_name
def _handle_streaming_response(self, response: requests.Response) -> str:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment