This commit is contained in:
femto 2023-09-19 12:23:22 +08:00
parent 04f4a353ad
commit 74217a1df3
5 changed files with 54 additions and 106 deletions

View file

@ -6,6 +6,7 @@
@File : environment.py
"""
from metagpt.actions.action import Action
from metagpt.logs import logger
from metagpt.utils.common import CodeParser
PROMPT_TEMPLATE = """
@ -38,9 +39,9 @@ class WriteTest(Action):
try:
code = CodeParser.parse_code(block="", text=code_rsp)
except Exception as e:
except Exception:
# Handle the exception if needed
print(f"An exception occurred: {str(e)}")
logger.error(f"Can't parse the code: {code_rsp}")
# Return code_rsp in case of an exception, assuming llm just returns code as it is and doesn't wrap it inside ```
code = code_rsp