From 8db5f22105b344eeebbe7df2281f9f062fd8fa0a Mon Sep 17 00:00:00 2001 From: stellahsr Date: Tue, 12 Dec 2023 17:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B3=A8=E9=87=8A=E5=92=8C?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metagpt/utils/save_code.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/metagpt/utils/save_code.py b/metagpt/utils/save_code.py index f1fdf0403..96c310336 100644 --- a/metagpt/utils/save_code.py +++ b/metagpt/utils/save_code.py @@ -16,7 +16,8 @@ def save_code_file(name: str, code_context: str, file_format: str = "py") -> Non Args: - name (str): The name of the folder to save the files. - code_context (str): The code content. - - file_format (str, optional): The file format, supports 'py' (Python file) and 'json' (JSON file). Default is 'py'. + - file_format (str, optional): The file format. Supports 'py' (Python file), 'json' (JSON file), and 'ipynb' (Jupyter Notebook file). Default is 'py'. + Returns: - None @@ -37,7 +38,7 @@ def save_code_file(name: str, code_context: str, file_format: str = "py") -> Non elif file_format == "ipynb": nbformat.write(code_context, file_path) else: - raise ValueError("Unsupported file format. Please choose 'py' or 'json'.") + raise ValueError("Unsupported file format. Please choose 'py', 'json', or 'ipynb'.")