update ser&deser after env_refactor

This commit is contained in:
better629 2023-12-19 14:22:52 +08:00
parent 35ac28c30e
commit ebc4fe4b17
15 changed files with 152 additions and 200 deletions

View file

@ -9,6 +9,7 @@ from pathlib import Path
import importlib
from tenacity import _utils
import traceback
from pydantic.json import pydantic_encoder
from metagpt.logs import logger
@ -46,7 +47,7 @@ def write_json_file(json_file: str, data: list, encoding=None):
folder_path.mkdir(parents=True, exist_ok=True)
with open(json_file, "w", encoding=encoding) as fout:
json.dump(data, fout, ensure_ascii=False, indent=4)
json.dump(data, fout, ensure_ascii=False, indent=4, default=pydantic_encoder)
def import_class(class_name: str, module_name: str) -> type: