mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
1. rename and modify guideline to plan
2. update prompt in ActionNode 3. add code comment 4. refactor Guideline code structure
This commit is contained in:
parent
5190dc4462
commit
42565c39e3
4 changed files with 7 additions and 8 deletions
|
|
@ -29,8 +29,8 @@ from metagpt.const import (
|
|||
BUGFIX_FILENAME,
|
||||
CODE_SUMMARIES_FILE_REPO,
|
||||
DOCS_FILE_REPO,
|
||||
PLAN_FILE_REPO,
|
||||
PLAN_FILENAME,
|
||||
PLAN_PDF_FILE_REPO,
|
||||
REQUIREMENT_FILENAME,
|
||||
TASK_FILE_REPO,
|
||||
TEST_OUTPUTS_FILE_REPO,
|
||||
|
|
@ -107,7 +107,7 @@ class WriteCode(Action):
|
|||
test_doc = await FileRepository.get_file(
|
||||
filename="test_" + coding_context.filename + ".json", relative_path=TEST_OUTPUTS_FILE_REPO
|
||||
)
|
||||
plan_doc = await FileRepository.get_file(filename=PLAN_FILENAME, relative_path=PLAN_PDF_FILE_REPO)
|
||||
plan_doc = await FileRepository.get_file(filename=PLAN_FILENAME, relative_path=PLAN_FILE_REPO)
|
||||
plan = plan_doc.content if plan_doc else ""
|
||||
requirement_doc = await FileRepository.get_file(filename=REQUIREMENT_FILENAME, relative_path=DOCS_FILE_REPO)
|
||||
summary_doc = None
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ from metagpt.actions.action import Action
|
|||
from metagpt.config import CONFIG
|
||||
from metagpt.const import (
|
||||
DOCS_FILE_REPO,
|
||||
PLAN_FILE_REPO,
|
||||
PLAN_FILENAME,
|
||||
PLAN_PDF_FILE_REPO,
|
||||
REQUIREMENT_FILENAME,
|
||||
)
|
||||
from metagpt.logs import logger
|
||||
|
|
@ -145,7 +145,7 @@ class WriteCodeReview(Action):
|
|||
async def run(self, *args, **kwargs) -> CodingContext:
|
||||
iterative_code = self.context.code_doc.content
|
||||
k = CONFIG.code_review_k_times or 1
|
||||
plan_doc = await FileRepository.get_file(filename=PLAN_FILENAME, relative_path=PLAN_PDF_FILE_REPO)
|
||||
plan_doc = await FileRepository.get_file(filename=PLAN_FILENAME, relative_path=PLAN_FILE_REPO)
|
||||
plan = plan_doc.content if plan_doc else ""
|
||||
mode = "plan" if plan else "normal"
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ SEQ_FLOW_FILE_REPO = "resources/seq_flow"
|
|||
SYSTEM_DESIGN_PDF_FILE_REPO = "resources/system_design"
|
||||
PRD_PDF_FILE_REPO = "resources/prd"
|
||||
TASK_PDF_FILE_REPO = "resources/api_spec_and_tasks"
|
||||
PLAN_PDF_FILE_REPO = "resources/plan"
|
||||
TEST_CODES_FILE_REPO = "tests"
|
||||
TEST_OUTPUTS_FILE_REPO = "test_outputs"
|
||||
CODE_SUMMARIES_FILE_REPO = "docs/code_summaries"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ from metagpt.const import (
|
|||
CODE_SUMMARIES_PDF_FILE_REPO,
|
||||
PLAN_FILE_REPO,
|
||||
PLAN_FILENAME,
|
||||
PLAN_PDF_FILE_REPO,
|
||||
PRDS_FILE_REPO,
|
||||
SYSTEM_DESIGN_FILE_REPO,
|
||||
TASK_FILE_REPO,
|
||||
)
|
||||
|
|
@ -123,7 +123,7 @@ class Engineer(Role):
|
|||
|
||||
dependencies = {coding_context.design_doc.root_relative_path, coding_context.task_doc.root_relative_path}
|
||||
if mode == "plan":
|
||||
dependencies.add(os.path.join(PLAN_PDF_FILE_REPO, PLAN_FILENAME))
|
||||
dependencies.add(os.path.join(PLAN_FILE_REPO, PLAN_FILENAME))
|
||||
await src_file_repo.save(
|
||||
coding_context.filename,
|
||||
dependencies=dependencies,
|
||||
|
|
@ -340,7 +340,7 @@ class Engineer(Role):
|
|||
|
||||
user_requirement = str(self.rc.memory.get_by_role("Human")[0])
|
||||
pool_contents = []
|
||||
prd = await FileRepository.get_all_files(relative_path=PLAN_PDF_FILE_REPO)
|
||||
prd = await FileRepository.get_all_files(relative_path=PRDS_FILE_REPO)
|
||||
for doc in prd:
|
||||
prd_json = json.loads(doc.content)
|
||||
product_requirement_pool = prd_json.get(REFINED_REQUIREMENT_POOL.key) or prd_json.get(REQUIREMENT_POOL.key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue