1. Remove PRD when write code

This commit is contained in:
mannaandpoem 2024-01-12 20:38:23 +08:00
parent a363691c38
commit 684d10bb24
4 changed files with 5 additions and 18 deletions

View file

@ -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:

View file

@ -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}

View file

@ -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(

View file

@ -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]))
product_requirement_pool = prd_json.get("Requirement Pool", prd_json.get("Refined Requirement Pool"))
prd = await prd_file_repo.get_all()
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()