From 7ec3b5c627a647bda28774f578ad957f8a6b5fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Sun, 7 Apr 2024 14:26:44 +0800 Subject: [PATCH] AttributeError: 'NoneType' object has no attribute 'sop' --- metagpt/actions/di/detect_intent.py | 3 ++- metagpt/tools/libs/software_development.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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)