🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix main process
geekan6c278bcfd68b
diff --git a/metagpt/actions/research.py b/metagpt/actions/research.pyindex 074cdee0a..2d2db4403 100644--- a/metagpt/actions/research.py+++ b/metagpt/actions/research.py@@ -181,6 +181,7 @@ class WebBrowseAndSummarize(Action):desc: str = "Explore the web and provide summaries of articles and webpages."browse_func: Union[Callable[[list[str]], None], None] = Noneweb_browser_engine: WebBrowserEngine = WebBrowserEngine(+ options={}, # FIXME: REMOVE options?engine=WebBrowserEngineType.CUSTOM if browse_func else None,run_func=browse_func,)diff --git a/metagpt/provider/ollama_api.py b/metagpt/provider/ollama_api.pyindex a15c46458..05bdb5a1f 100644--- a/metagpt/provider/ollama_api.py+++ b/metagpt/provider/ollama_api.py@@ -19,7 +19,8 @@ from metagpt.logs import loggerfrom metagpt.provider.base_gpt_api import BaseGPTAPIfrom metagpt.provider.general_api_requestor import GeneralAPIRequestorfrom metagpt.provider.llm_provider_registry import register_provider-from metagpt.provider.openai_api import CostManager, log_and_reraise+from metagpt.provider.openai_api import log_and_reraise+from metagpt.utils.cost_manager import CostManagerclass OllamaCostManager(CostManager):diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.pyindex 1c292263f..44f857ed9 100644--- a/metagpt/provider/openai_api.py+++ b/metagpt/provider/openai_api.py@@ -28,7 +28,7 @@ from tenacity import ()from metagpt.config import CONFIG, Config, LLMProviderEnum-from metagpt.const import DEFAULT_MAX_TOKENS+from metagpt.const import DEFAULT_MAX_TOKENS, DEFAULT_TOKEN_SIZEfrom metagpt.logs import loggerfrom metagpt.provider.base_gpt_api import BaseGPTAPIfrom metagpt.provider.constant import GENERAL_FUNCTION_SCHEMA, GENERAL_TOOL_CHOICEdiff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.pyindex 12deaa5bb..d2deca114 100644--- a/metagpt/roles/engineer.py+++ b/metagpt/roles/engineer.py@@ -78,7 +78,8 @@ class Engineer(Role):n_borg: int = 1use_code_review: bool = Falsecode_todos: list = []- summarize_todos = []+ summarize_todos: list = []+ next_todo_action: str = ""def __init__(self, **kwargs) -> None:super().__init__(**kwargs)@@ -87,7 +88,7 @@ class Engineer(Role):self._watch([WriteTasks, SummarizeCode, WriteCode, WriteCodeReview, FixBug])self.code_todos = []self.summarize_todos = []- self._next_todo = any_to_name(WriteCode)+ self.next_todo_action = any_to_name(WriteCode)@staticmethoddef _parse_tasks(task_msg: Document) -> list[str]:@@ -131,10 +132,10 @@ class Engineer(Role):if self._rc.todo is None:return Noneif isinstance(self._rc.todo, WriteCode):- self._next_todo = any_to_name(SummarizeCode)+ self.next_todo_action = any_to_name(SummarizeCode)return await self._act_write_code()if isinstance(self._rc.todo, SummarizeCode):- self._next_todo = any_to_name(WriteCode)+ self.next_todo_action = any_to_name(WriteCode)return await self._act_summarize()return Nonediff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.pyindex 0f18c9cb2..460f29e05 100644--- a/metagpt/roles/product_manager.py+++ b/metagpt/roles/product_manager.py@@ -30,13 +30,14 @@ class ProductManager(Role):profile: str = "Product Manager"goal: str = "efficiently create a successful product that meets market demands and user expectations"constraints: str = "utilize the same language as the user requirements for seamless communication"+ todo_action: str = ""def __init__(self, **kwargs) -> None:super().__init__(**kwargs)self._init_actions([PrepareDocuments, WritePRD])self._watch([UserRequirement, PrepareDocuments])- self._todo = any_to_name(PrepareDocuments)+ self.todo_action = any_to_name(PrepareDocuments)async def _think(self) -> None:"""Decide what to do"""@@ -44,13 +45,8 @@ class ProductManager(Role):self._set_state(1)else:self._set_state(0)- self._todo = any_to_name(WritePRD)+ self.todo_action = any_to_name(WritePRD)return self._rc.todoasync def _observe(self, ignore_memory=False) -> int:- return await super(ProductManager, self)._observe(ignore_memory=True)-- @property- def todo(self) -> str:- """AgentStore uses this attribute to display to the user what actions the current role should take."""- return self._todo+ return await super()._observe(ignore_memory=True)diff --git a/metagpt/roles/role.py b/metagpt/roles/role.pyindex 8d229beec..992ff83d2 100644--- a/metagpt/roles/role.py+++ b/metagpt/roles/role.py@@ -345,11 +345,6 @@ class Role(BaseModel):env.set_subscription(self, self.subscription)self.refresh_system_message() # add env message to system message- @property- def subscription(self) -> Set:- """The labels for messages to be consumed by the Role object."""- return set(self._subscription)-@propertydef action_count(self):"""Return number of action"""