mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-26 09:16:21 +02:00
deal with nested BaseModel
This commit is contained in:
parent
15279376d4
commit
6877fa444f
4 changed files with 16 additions and 11 deletions
|
|
@ -450,14 +450,12 @@ def serialize_decorator(func):
|
|||
async def wrapper(self, *args, **kwargs):
|
||||
try:
|
||||
result = await func(self, *args, **kwargs)
|
||||
self.serialize() # Team.serialize
|
||||
return result
|
||||
except KeyboardInterrupt as kbi:
|
||||
logger.error(f"KeyboardInterrupt occurs, start to serialize the project, exp:\n{format_trackback_info()}")
|
||||
self.serialize() # Team.serialize
|
||||
except Exception as exp:
|
||||
logger.error(f"Exception occurs, start to serialize the project, exp:\n{format_trackback_info()}")
|
||||
self.serialize() # Team.serialize
|
||||
self.serialize() # Team.serialize
|
||||
|
||||
return wrapper
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ def serialize_general_message(message: "Message") -> dict:
|
|||
message_cp = copy.deepcopy(message)
|
||||
ic = message_cp.instruct_content
|
||||
if ic:
|
||||
# model create by pydantic create_model like `pydantic.main.prd`, can't pickle.dump directly
|
||||
# model create by pydantic create_model like `pydantic.main.prd`, can't load directly
|
||||
schema = ic.schema()
|
||||
mapping = actionoutout_schema_to_mapping(schema)
|
||||
mapping = actionoutput_mapping_to_str(mapping)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue