change PROJECT_ROOT setting & SoftwareCompany -> Team

This commit is contained in:
garylin2099 2023-11-08 19:42:30 +08:00
parent c6350efd7f
commit 56c2a162ac
10 changed files with 54 additions and 90 deletions

View file

@ -6,7 +6,7 @@
@File : const.py
"""
from pathlib import Path
from loguru import logger
def get_project_root():
"""Search upwards to find the project root directory."""
@ -17,10 +17,14 @@ def get_project_root():
or (current_path / ".project_root").exists()
or (current_path / ".gitignore").exists()
):
# use metagpt with git clone will land here
return current_path
parent_path = current_path.parent
if parent_path == current_path:
raise Exception("Project root not found.")
# use metagpt with pip install will land here
cwd = Path.cwd()
logger.info(f"RPOJECT_ROOT set to current working directory: {str(cwd)}")
return cwd
current_path = parent_path

View file

@ -207,6 +207,7 @@ class Engineer(Role):
async def _act(self) -> Message:
"""Determines the mode of action based on whether code review is used."""
logger.info(f"{self._setting}: ready to WriteCode")
if self.use_code_review:
return await self._act_sp_precision()
return await self._act_sp()

View file

@ -16,10 +16,10 @@ from metagpt.schema import Message
from metagpt.utils.common import NoMoneyException
class SoftwareCompany(BaseModel):
class Team(BaseModel):
"""
Software Company: Possesses a team, SOP (Standard Operating Procedures), and a platform for instant messaging,
dedicated to writing executable code.
Team: Possesses one or more roles (agents), SOP (Standard Operating Procedures), and a platform for instant messaging,
dedicated to perform any multi-agent activity, such as collaboratively writing executable code.
"""
environment: Environment = Field(default_factory=Environment)
investment: float = Field(default=10.0)
@ -42,10 +42,10 @@ class SoftwareCompany(BaseModel):
if CONFIG.total_cost > CONFIG.max_budget:
raise NoMoneyException(CONFIG.total_cost, f'Insufficient funds: {CONFIG.max_budget}')
def start_project(self, idea):
def start_project(self, idea, send_to: str = ""):
"""Start a project from publishing boss requirement."""
self.idea = idea
self.environment.publish_message(Message(role="BOSS", content=idea, cause_by=BossRequirement))
self.environment.publish_message(Message(role="Human", content=idea, cause_by=BossRequirement, send_to=send_to))
def _save(self):
logger.info(self.json())