Skip to content

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

feat: merge fixbug/geekan/v0.5-release

莘权 马559300811002
diff --cc metagpt/team.py
index ed406ee4c,5ce07ef13..d613a04ef
--- a/metagpt/team.py
+++ b/metagpt/team.py
@@@ -7,6 -7,7 +7,8 @@@
@Modified By: mashenquan, 2023/11/27. Add an archiving operation after completing the project, as specified in
Section 2.2.3.3 of RFC 135.
"""
+ import warnings
++
from pydantic import BaseModel, Field
from metagpt.actions import UserRequirement
@@@ -42,23 -43,29 +44,36 @@@ class Team(BaseModel)
CONFIG.max_budget = investment
logger.info(f"Investment: ${investment}.")
- def _check_balance(self):
- if CONFIG.total_cost > CONFIG.max_budget:
- raise NoMoneyException(CONFIG.total_cost, f"Insufficient funds: {CONFIG.max_budget}")
+ @staticmethod
+ def _check_balance():
+ if CONFIG.cost_manager.total_cost > CONFIG.cost_manager.max_budget:
+ raise NoMoneyException(
+ CONFIG.cost_manager.total_cost, f"Insufficient funds: {CONFIG.cost_manager.max_budget}"
+ )
def run_project(self, idea, send_to: str = ""):
- """Start a project from publishing user requirement."""
+ """Run a project from publishing user requirement."""
self.idea = idea
# Human requirement.
self.env.publish_message(
- Message(role="Human", content=idea, cause_by=UserRequirement, send_to=send_to or MESSAGE_ROUTE_TO_ALL)
+ Message(role="Human", content=idea, cause_by=UserRequirement, send_to=send_to or MESSAGE_ROUTE_TO_ALL),
+ peekable=False,
)
+ def start_project(self, idea, send_to: str = ""):
+ """
+ Deprecated: This method will be removed in the future.
+ Please use the `run_project` method instead.
+ """
- warnings.warn("The 'start_project' method is deprecated and will be removed in the future. "
- "Please use the 'run_project' method instead.",
- DeprecationWarning, stacklevel=2)
++ warnings.warn(
++ "The 'start_project' method is deprecated and will be removed in the future. "
++ "Please use the 'run_project' method instead.",
++ DeprecationWarning,
++ stacklevel=2,
++ )
+ return self.run_project(idea=idea, send_to=send_to)
+
def _save(self):
logger.info(self.json(ensure_ascii=False))