diff --git a/metagpt/actions/write_code.py b/metagpt/actions/write_code.py index 6cfde2385..5a3b238fa 100644 --- a/metagpt/actions/write_code.py +++ b/metagpt/actions/write_code.py @@ -66,6 +66,11 @@ ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenc ## {filename} ... ``` +## Code: {filename} +```javascript +// {filename} +... +``` # Instruction: Based on the context, follow "Format example", write code. diff --git a/metagpt/actions/write_code_plan_and_change_an.py b/metagpt/actions/write_code_plan_and_change_an.py index a90946981..a3c0e50a4 100644 --- a/metagpt/actions/write_code_plan_and_change_an.py +++ b/metagpt/actions/write_code_plan_and_change_an.py @@ -184,6 +184,11 @@ Role: You are a professional engineer; The main goal is to complete incremental ## {filename} ... ``` +## Code: {filename} +```javascript +// {filename} +... +``` # Instruction: Based on the context, follow "Format example", write or rewrite code. ## Write/Rewrite Code: Only write one file {filename}, write or rewrite complete code using triple quotes based on the following attentions and context. diff --git a/metagpt/actions/write_code_review.py b/metagpt/actions/write_code_review.py index ed868c867..f0faea701 100644 --- a/metagpt/actions/write_code_review.py +++ b/metagpt/actions/write_code_review.py @@ -110,11 +110,16 @@ LGTM REWRITE_CODE_TEMPLATE = """ # Instruction: rewrite code based on the Code Review and Actions -## Rewrite Code: CodeBlock. If it still has some bugs, rewrite {filename} with triple quotes. Do your utmost to optimize THIS SINGLE FILE. Return all completed codes and prohibit the return of unfinished codes. -```Code +## Rewrite Code: CodeBlock. If it still has some bugs, rewrite {filename} using a Markdown code block, with the filename docstring preceding the code block. Do your utmost to optimize THIS SINGLE FILE. Return all completed codes and prohibit the return of unfinished codes. +```python ## {filename} ... ``` +or +```javascript +// {filename} +... +``` """