1717from ex_app .lib .nc_model import model
1818from ex_app .lib .tools import get_tools
1919from ex_app .lib .memorysaver import MemorySaver
20+ from ex_app .lib .jsonplus import JsonPlusSerializer
2021
2122
2223# Dummy thread id as we return the whole state
@@ -66,7 +67,7 @@ def load_conversation(conversation_token: str):
6667 # Verify whether this was signed by this instance of context_agent
6768 serialized_state = verify_signature (conversation_token , key )
6869 # Deserialize the saved state
69- conversation = checkpointer . serde .loads (serialized_state .encode ())
70+ conversation = JsonPlusSerializer () .loads (serialized_state .encode ())
7071 # Get the last checkpoint state
7172 last_checkpoint = conversation ['last_checkpoint' ]
7273 # get the last checkpointer config
@@ -88,7 +89,8 @@ def export_conversation(checkpointer):
8889 last_checkpoint = checkpointer .storage [last_config ['configurable' ]['thread_id' ]][last_config ['configurable' ]['checkpoint_ns' ]][last_config ['configurable' ]['checkpoint_id' ]]
8990 # prepare the to-serialize blob
9091 state = {"last_config" : last_config , "last_checkpoint" : last_checkpoint }
91- serialized_state = checkpointer .serde .dumps (state )
92+ serialized_state = JsonPlusSerializer ().dumps (state )
93+ print (serialized_state )
9294 # sign the serialized state
9395 conversation_token = add_signature (serialized_state .decode ('utf-8' ), key )
9496 return conversation_token
0 commit comments