Skip to content

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

modify: get value of ActionNode by key of ActionNode

mannaandpoemdb086e47e764
diff --git a/metagpt/actions/design_api.py b/metagpt/actions/design_api.py
index 073eb20ae..933c59b74 100644
--- a/metagpt/actions/design_api.py
+++ b/metagpt/actions/design_api.py
@@ -14,7 +14,14 @@ from pathlib import Path
from typing import Optional
from metagpt.actions import Action, ActionOutput
-from metagpt.actions.design_api_an import DESIGN_API_NODE, REFINED_DESIGN_NODES
+from metagpt.actions.design_api_an import (
+ DATA_STRUCTURES_AND_INTERFACES,
+ DESIGN_API_NODE,
+ PROGRAM_CALL_FLOW,
+ REFINED_DATA_STRUCTURES_AND_INTERFACES,
+ REFINED_DESIGN_NODES,
+ REFINED_PROGRAM_CALL_FLOW,
+)
from metagpt.config import CONFIG
from metagpt.const import (
DATA_API_DESIGN_FILE_REPO,
@@ -109,7 +116,7 @@ class WriteDesign(Action):
@staticmethod
async def _save_data_api_design(design_doc):
m = json.loads(design_doc.content)
- data_api_design = m.get("Data structures and interfaces") or m.get("Refined Data structures and interfaces")
+ data_api_design = m.get(DATA_STRUCTURES_AND_INTERFACES.key) or m.get(REFINED_DATA_STRUCTURES_AND_INTERFACES.key)
if not data_api_design:
return
pathname = CONFIG.git_repo.workdir / DATA_API_DESIGN_FILE_REPO / Path(design_doc.filename).with_suffix("")
@@ -119,7 +126,7 @@ class WriteDesign(Action):
@staticmethod
async def _save_seq_flow(design_doc):
m = json.loads(design_doc.content)
- seq_flow = m.get("Program call flow") or m.get("Refined Program call flow")
+ seq_flow = m.get(PROGRAM_CALL_FLOW.key) or m.get(REFINED_PROGRAM_CALL_FLOW.key)
if not seq_flow:
return
pathname = CONFIG.git_repo.workdir / Path(SEQ_FLOW_FILE_REPO) / Path(design_doc.filename).with_suffix("")
diff --git a/metagpt/actions/project_management.py b/metagpt/actions/project_management.py
index 3c379d96f..6e298e500 100644
--- a/metagpt/actions/project_management.py
+++ b/metagpt/actions/project_management.py
@@ -15,7 +15,11 @@ from typing import Optional
from metagpt.actions import ActionOutput
from metagpt.actions.action import Action
-from metagpt.actions.project_management_an import PM_NODE, REFINED_PM_NODES
+from metagpt.actions.project_management_an import (
+ PM_NODE,
+ REFINED_PM_NODES,
+ REQUIRED_PYTHON_PACKAGES,
+)
from metagpt.config import CONFIG
from metagpt.const import (
PACKAGE_REQUIREMENTS_FILENAME,
@@ -100,7 +104,7 @@ class WriteTasks(Action):
@staticmethod
async def _update_requirements(doc):
m = json.loads(doc.content)
- packages = set(m.get("Required Python third-party packages", set()))
+ packages = set(m.get(REQUIRED_PYTHON_PACKAGES.key, set()))
file_repo = CONFIG.git_repo.new_file_repository()
requirement_doc = await file_repo.get(filename=PACKAGE_REQUIREMENTS_FILENAME)
if not requirement_doc:
diff --git a/metagpt/actions/write_code.py b/metagpt/actions/write_code.py
index ce0e2fe3b..30ebf09f8 100644
--- a/metagpt/actions/write_code.py
+++ b/metagpt/actions/write_code.py
@@ -21,6 +21,7 @@ from pydantic import Field
from tenacity import retry, stop_after_attempt, wait_random_exponential
from metagpt.actions.action import Action
+from metagpt.actions.project_management_an import REFINED_TASK_LIST, TASK_LIST
from metagpt.actions.write_code_guideline_an import REFINED_CODE_TEMPLATE
from metagpt.config import CONFIG
from metagpt.const import (
@@ -180,7 +181,7 @@ class WriteCode(Action):
if not task_doc.content:
task_doc.content = FileRepository.get_file(filename=task_doc.filename, relative_path=TASK_FILE_REPO)
m = json.loads(task_doc.content)
- code_filenames = m.get("Task list", []) if mode == "normal" else m.get("Refined Task list", [])
+ code_filenames = m.get(TASK_LIST.key, []) if mode == "normal" else m.get(REFINED_TASK_LIST.key, [])
codes = []
src_file_repo = CONFIG.git_repo.new_file_repository(relative_path=CONFIG.src_workspace)
diff --git a/metagpt/actions/write_prd.py b/metagpt/actions/write_prd.py
index 84a9fa13d..e12c1e1ec 100644
--- a/metagpt/actions/write_prd.py
+++ b/metagpt/actions/write_prd.py
@@ -21,6 +21,7 @@ from metagpt.actions import Action, ActionOutput
from metagpt.actions.action_node import ActionNode
from metagpt.actions.fix_bug import FixBug
from metagpt.actions.write_prd_an import (
+ COMPETITIVE_QUADRANT_CHART,
PROJECT_NAME,
REFINE_PRD_NODE,
REFINE_PRD_TEMPLATE,
@@ -166,7 +167,7 @@ class WritePRD(Action):
@staticmethod
async def _save_competitive_analysis(prd_doc):
m = json.loads(prd_doc.content)
- quadrant_chart = m.get("Competitive Quadrant Chart")
+ quadrant_chart = m.get(COMPETITIVE_QUADRANT_CHART.key)
if not quadrant_chart:
return
pathname = (