Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

1. Remove PRD when write code

mannaandpoem684d10bb247d
diff --git a/metagpt/actions/write_code.py b/metagpt/actions/write_code.py
index acc25627e..25e65ddc7 100644
--- a/metagpt/actions/write_code.py
+++ b/metagpt/actions/write_code.py
@@ -27,7 +27,6 @@ from metagpt.const import (
BUGFIX_FILENAME,
CODE_SUMMARIES_FILE_REPO,
DOCS_FILE_REPO,
- PRDS_FILE_REPO,
REQUIREMENT_FILENAME,
TASK_FILE_REPO,
TEST_OUTPUTS_FILE_REPO,
@@ -117,10 +116,6 @@ class WriteCode(Action):
docs_file_repo = CONFIG.git_repo.new_file_repository(relative_path=DOCS_FILE_REPO)
requirement_doc = await docs_file_repo.get(filename=REQUIREMENT_FILENAME)
- prd_file_repo = CONFIG.git_repo.new_file_repository(PRDS_FILE_REPO)
- prd = await prd_file_repo.get_all()
- prd_json = json.loads("\n".join([doc.content for doc in prd]))
- product_requirement_pool = prd_json.get("Requirement Pool", prd_json.get("Refined Requirement Pool"))
guideline = kwargs.get("guideline", "")
if bug_feedback:
code_context = coding_context.code_doc.content
@@ -132,7 +127,6 @@ class WriteCode(Action):
if guideline:
prompt = REFINED_CODE_TEMPLATE.format(
user_requirement=requirement_doc.content if requirement_doc else "",
- product_requirement_pool=str(product_requirement_pool),
guideline=guideline,
design=coding_context.design_doc.content if coding_context.design_doc else "",
tasks=coding_context.task_doc.content if coding_context.task_doc else "",
@@ -188,11 +182,7 @@ class WriteCode(Action):
else:
doc = await src_file_repo.get(filename=filename) # 使用先前生成的代码
if not doc:
- # if filename in old_files:
- # doc = await old_file_repo.get(filename=filename) # 使用原始代码
- # else:
- # continue
- continue # 跳过
+ continue
codes.append(f"----- {filename}\n```{doc.content}```")
else:
diff --git a/metagpt/actions/write_code_guideline_an.py b/metagpt/actions/write_code_guideline_an.py
index 9521e51e6..7b27fbe4c 100644
--- a/metagpt/actions/write_code_guideline_an.py
+++ b/metagpt/actions/write_code_guideline_an.py
@@ -395,9 +395,6 @@ Role: You are a professional engineer; The main goal is to complete incremental
## User New Requirements
{user_requirement}
-## Product Requirement Pool
-{product_requirement_pool}
-
## Guidelines and Incremental Change
{guideline}
diff --git a/metagpt/actions/write_code_review.py b/metagpt/actions/write_code_review.py
index e3c5fd2ac..7fca9748c 100644
--- a/metagpt/actions/write_code_review.py
+++ b/metagpt/actions/write_code_review.py
@@ -161,7 +161,7 @@ class WriteCodeReview(Action):
user_requirement = requirement_doc.content if requirement_doc else ""
prd_file_repo = CONFIG.git_repo.new_file_repository(PRDS_FILE_REPO)
prd = await prd_file_repo.get_all()
- prd_json = json.loads("\n".join([doc.content for doc in prd]))
+ prd_json = json.loads(prd[0].content)
product_requirement_pool = prd_json.get("Requirement Pool", prd_json.get("Refined Requirement Pool"))
context = "\n".join(
diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.py
index e67963de5..1d1fed2b8 100644
--- a/metagpt/roles/engineer.py
+++ b/metagpt/roles/engineer.py
@@ -350,10 +350,10 @@ class Engineer(Role):
prd_file_repo = CONFIG.git_repo.new_file_repository(PRDS_FILE_REPO)
design_file_repo = CONFIG.git_repo.new_file_repository(SYSTEM_DESIGN_FILE_REPO)
task_file_repo = CONFIG.git_repo.new_file_repository(TASK_FILE_REPO)
+
prd = await prd_file_repo.get_all()
- prd_json = json.loads("\n".join([doc.content for doc in prd]))
+ prd_json = json.loads(prd[0].content)
product_requirement_pool = prd_json.get("Requirement Pool", prd_json.get("Refined Requirement Pool"))
-
design = await design_file_repo.get_all()
design = "\n".join([doc.content for doc in design])
tasks = await task_file_repo.get_all()