Skip to content

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

AttributeError: 'NoneType' object has no attribute 'sop'

莘权 马7ec3b5c627a6
diff --git a/metagpt/actions/di/detect_intent.py b/metagpt/actions/di/detect_intent.py
index 9109c01bb..92d4aeb54 100644
--- a/metagpt/actions/di/detect_intent.py
+++ b/metagpt/actions/di/detect_intent.py
@@ -98,7 +98,8 @@ class DetectIntent(Action):
sop_type = await self._aask(prompt)
sop_type = sop_type.strip()
- sop = SOPItem.get_type(sop_type).sop
+ item = SOPItem.get_type(sop_type)
+ sop = item.sop if item else None
req_with_sop = (
REQ_WITH_SOP.format(user_requirement=user_requirement, sop="\n".join(sop)) if sop else user_requirement
diff --git a/metagpt/tools/libs/software_development.py b/metagpt/tools/libs/software_development.py
index acc3716b1..04da431b7 100644
--- a/metagpt/tools/libs/software_development.py
+++ b/metagpt/tools/libs/software_development.py
@@ -43,7 +43,7 @@ async def write_prd(idea: str, project_path: Optional[str | Path] = None) -> Pat
from metagpt.roles import ProductManager
ctx = Context()
- if project_path:
+ if project_path and Path(project_path).exists():
ctx.config.project_path = Path(project_path)
ctx.config.inc = True
role = ProductManager(context=ctx)