Merge branch 'fixbug/mgx_ops' into 'mgx_ops'

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

See merge request pub/MetaGPT!22
This commit is contained in:
洪思睿 2024-04-07 06:29:29 +00:00
commit ae343aee55
2 changed files with 3 additions and 2 deletions

View file

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

View file

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