-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always getting the same Code Plan and Change during the incremental development #871
Comments
@elpasticho If we add a feature that allows human manual intervention to modify the code plan, can this issue be improved? Furthermore, which specific actions, if human manually modified, would most significantly improve the success rate of project generation? |
Getting these same steps for a whole different project: [CONTENT]
{
"Development Plan": [
"Implement a comprehensive development plan for the calculator.py file by extending its functionality to incorporate methods for subtraction, multiplication, and division.",
"Update the existing codebase in main.py to incorporate new API endpoints for subtraction, multiplication, and division operations."
],
"Incremental Change": [
"```diff\n--- Old/calculator.py\n+++ New/calculator.py\n\nclass Calculator:\n self.result = number1 + number2\n return self.result\n\n- def sub(self, number1, number2) -> float:\n+ def subtract(self, number1: float, number2: float) -> float:\n+ \"\"\"\n+ Subtracts the second number from the first and returns the result.\n+\n+ Args:\n+ number1 (float): The number to be subtracted from.\n+ number2 (float): The number to subtract.\n+\n+ Returns:\n+ float: The difference of number1 and number2.\n+ \"\"\"\n+ self.result = number1 - number2\n+ return self.result\n+\n def multiply(self, number1: float, number2: float) -> float:\n- pass\n+ \"\"\"\n+ Multiplies two numbers and returns the result.\n+\n+ Args:\n+ number1 (float): The first number to multiply.\n+ number2 (float): The second number to multiply.\n+\n+ Returns:\n+ float: The product of number1 and number2.\n+ \"\"\"\n+ self.result = number1 * number2\n+ return self.result\n+\n def divide(self, number1: float, number2: float) -> float:\n- pass\n+ \"\"\"\n+ ValueError: If the second number is zero.\n+ \"\"\"\n+ if number2 == 0:\n+ raise ValueError('Cannot divide by zero')\n+ self.result = number1 / number2\n+ return self.result\n+\n- def reset_result(self):\n+ def clear(self):\n+ if self.result != 0.0:\n+ print(\"Result is not zero, clearing...\")\n+ else:\n+ print(\"Result is already zero, no need to clear.\")\n+\n self.result = 0.0\n```",
"```diff\n--- Old/main.py\n+++ New/main.py\n\ndef add_numbers():\n result = calculator.add_numbers(num1, num2)\n return jsonify({'result': result}), 200\n\n-# TODO: Implement subtraction, multiplication, and division operations\n[email protected]('/subtract_numbers', methods=['POST'])\n+def subtract_numbers():\n+ data = request.get_json()\n+ num1 = data.get('num1', 0)\n+ num2 = data.get('num2', 0)\n+ result = calculator.subtract_numbers(num1, num2)\n+ return jsonify({'result': result}), 200\n+\n[email protected]('/multiply_numbers', methods=['POST'])\n+def multiply_numbers():\n+ data = request.get_json()\n+ num1 = data.get('num1', 0)\n+ num2 = data.get('num2', 0)\n+ try:\n+ result = calculator.divide_numbers(num1, num2)\n+ except ValueError as e:\n+ return jsonify({'error': str(e)}), 400\n+ return jsonify({'result': result}), 200\n+\n if __name__ == '__main__':\n app.run()\n```"
]
}
[/CONTENT] |
I've consolidated all the incremental development-related issues into #1498 to make it easier to follow up. Any new issues will be discussed in this newly opened issue, and the old issue will be closed. |
Bug description
Always getting the same code plan and chage during the incremental step and the stop working. Im just trying to add a new requirement into an application metagpt already created:
2024-02-07 15:47:24.846 | INFO | metagpt.roles.engineer:_act_code_plan_and_change:209 - Writing code plan and change..
[CONTENT]
{
"Code Plan And Change": "\n1. Plan for calculator.py: Enhance the functionality of
calculator.py
by extending it to incorporate methods for subtraction, multiplication, and division. Additionally, implement robust error handling for the division operation to mitigate potential issues related to division by zero. \npython\nclass Calculator:\n self.result = number1 + number2\n return self.result\n\n- def sub(self, number1, number2) -> float:\n+ def subtract(self, number1: float, number2: float) -> float:\n+ '''\n+ Subtracts the second number from the first and returns the result.\n+\n+ Args:\n+ number1 (float): The number to be subtracted from.\n+ number2 (float): The number to subtract.\n+\n+ Returns:\n+ float: The difference of number1 and number2.\n+ '''\n+ self.result = number1 - number2\n+ return self.result\n+\n def multiply(self, number1: float, number2: float) -> float:\n- pass\n+ '''\n+ Multiplies two numbers and returns the result.\n+\n+ Args:\n+ number1 (float): The first number to multiply.\n+ number2 (float): The second number to multiply.\n+\n+ Returns:\n+ float: The product of number1 and number2.\n+ '''\n+ self.result = number1 * number2\n+ return self.result\n+\n def divide(self, number1: float, number2: float) -> float:\n- pass\n+ '''\n+ ValueError: If the second number is zero.\n+ '''\n+ if number2 == 0:\n+ raise ValueError('Cannot divide by zero')\n+ self.result = number1 / number2\n+ return self.result\n+\n- def reset_result(self):\n+ def clear(self):\n+ if self.result != 0.0:\n+ print(\"Result is not zero, clearing...\")\n+ else:\n+ print(\"Result is already zero, no need to clear.\")\n+\n self.result = 0.0\n
\n\n2. Plan for main.py: Integrate new API endpoints for subtraction, multiplication, and division into the existing codebase ofmain.py
. Then, ensure seamless integration with the overall application architecture and maintain consistency with coding standards.\npython\ndef add_numbers():\n result = calculator.add_numbers(num1, num2)\n return jsonify({'result': result}), 200\n\n-# TODO: Implement subtraction, multiplication, and division operations\[email protected]('/subtract_numbers', methods=['POST'])\n+def subtract_numbers():\n+ data = request.get_json()\n+ num1 = data.get('num1', 0)\n+ num2 = data.get('num2', 0)\n+ result = calculator.subtract_numbers(num1, num2)\n+ return jsonify({'result': result}), 200\n+\[email protected]('/multiply_numbers', methods=['POST'])\n+def multiply_numbers():\n+ data = request.get_json()\n+ num1 = data.get('num1', 0)\n+ num2 = data.get('num2', 0)\n+ try:\n+ result = calculator.divide_numbers(num1, num2)\n+ except ValueError as e:\n+ return jsonify({'error': str(e)}), 400\n+ return jsonify({'result': result}), 200\n+\n if __name__ == '__main__':\n app.run()\n
"}
[/CONTENT]
I noticed its just showing what you have in this file: https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/write_code_plan_and_change_an.py
Bug solved method
Environment information
Running over Mac
Screenshots or logs
The text was updated successfully, but these errors were encountered: