Merge branch 'pip_bugfix' into 'mgx_ops'

Pip bugfix

See merge request pub/MetaGPT!36
This commit is contained in:
洪思睿 2024-04-10 09:50:48 +00:00
commit 004abee9f3
3 changed files with 5 additions and 0 deletions

View file

@ -27,6 +27,8 @@ from metagpt.actions import Action
from metagpt.const import DEFAULT_WORKSPACE_ROOT
from metagpt.logs import ToolLogItem, log_tool_output, logger
INSTALL_KEEPLEN = 500
class ExecuteNbCode(Action):
"""execute notebook code block, return result to llm, and display it."""
@ -207,6 +209,7 @@ class ExecuteNbCode(Action):
if "!pip" in code:
success = False
outputs = outputs[-INSTALL_KEEPLEN:]
file_path = DEFAULT_WORKSPACE_ROOT / "code.ipynb"
nbformat.write(self.nb, file_path)

View file

@ -33,6 +33,7 @@ class MGX(DataInterpreter):
if self.use_intent: # add mode
user_message = Message(content=goal, role="user")
goal = await self._detect_intent(user_message)
logger.info(f"Goal is {goal}")
await self.planner.update_plan(goal=goal)

View file

@ -49,6 +49,7 @@ async def write_prd(idea: str, project_path: Optional[str | Path] = None) -> Pat
if project_path and Path(project_path).exists():
ctx.config.project_path = Path(project_path)
ctx.config.inc = True
role = ProductManager(context=ctx)
msg = await role.run(with_message=Message(content=idea, cause_by=UserRequirement))
await role.run(with_message=msg)