Building AI agents, atomically
Copy chat history without serializing local schemas
黄耀鑫(Huang Yaoxin)7e1d02cf03c4
diff --git a/atomic-agents/atomic_agents/context/chat_history.py b/atomic-agents/atomic_agents/context/chat_history.pyindex b679a74..41ae1af 100644--- a/atomic-agents/atomic_agents/context/chat_history.py+++ b/atomic-agents/atomic_agents/context/chat_history.py@@ -1,5 +1,6 @@import jsonimport uuid+from copy import deepcopyfrom enum import Enumfrom pathlib import Pathfrom typing import Dict, List, Optional, Tuple, Type, Union@@ -201,7 +202,7 @@ class ChatHistory(BaseChatHistory):ChatHistory: A copy of the chat history."""new_history = ChatHistory(max_messages=self.max_messages)- new_history.load(self.dump())+ new_history.history = deepcopy(self.history)new_history.current_turn_id = self.current_turn_idreturn new_history