From 6f3d1d6f5e6c6080bab47ad28184c698c5dd7913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Thu, 30 Nov 2023 14:58:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fixbug:=20=E5=A2=9E=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=9C=80=E6=B1=82=E6=B2=A1=E5=86=99=E5=85=A5?= =?UTF-8?q?docs/requirement.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metagpt/actions/prepare_documents.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/metagpt/actions/prepare_documents.py b/metagpt/actions/prepare_documents.py index 30558c93f..8656de812 100644 --- a/metagpt/actions/prepare_documents.py +++ b/metagpt/actions/prepare_documents.py @@ -23,14 +23,11 @@ class PrepareDocuments(Action): super().__init__(name, context, llm) async def run(self, with_messages, **kwargs): - if CONFIG.git_repo: - doc = await FileRepository.get_file(filename=REQUIREMENT_FILENAME, relative_path=DOCS_FILE_REPO) - return ActionOutput(content=doc.json(exclue="content"), instruct_content=doc) - - # Create and initialize the workspace folder, initialize the Git environment. - CONFIG.git_repo = GitRepository() - workdir = Path(CONFIG.WORKDIR) if CONFIG.WORKDIR else WORKSPACE_ROOT / FileRepository.new_filename() - CONFIG.git_repo.open(local_path=workdir, auto_init=True) + if not CONFIG.git_repo: + # Create and initialize the workspace folder, initialize the Git environment. + CONFIG.git_repo = GitRepository() + workdir = Path(CONFIG.WORKDIR) if CONFIG.WORKDIR else WORKSPACE_ROOT / FileRepository.new_filename() + CONFIG.git_repo.open(local_path=workdir, auto_init=True) # Write the newly added requirements from the main parameter idea to `docs/requirement.txt`. doc = Document(root_path=DOCS_FILE_REPO, filename=REQUIREMENT_FILENAME, content=with_messages[0].content) From 269eee4643728c5e5f0f6ce3efffa854f88c8f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Thu, 30 Nov 2023 19:20:53 +0800 Subject: [PATCH 2/4] fixbug: The assumption that messages in 'memory' have been processed has been revoked. --- metagpt/roles/product_manager.py | 3 +++ metagpt/roles/role.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.py index bc6771829..966115c0f 100644 --- a/metagpt/roles/product_manager.py +++ b/metagpt/roles/product_manager.py @@ -50,3 +50,6 @@ class ProductManager(Role): else: self._set_state(0) return self._rc.todo + + async def _observe(self, ignore_memory=False) -> int: + return await super(ProductManager, self)._observe(ignore_memory=True) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 1c9da7e6c..fe121ed1a 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -218,12 +218,12 @@ class Role: return msg - async def _observe(self) -> int: + async def _observe(self, ignore_memory=False) -> int: """Prepare new messages for processing from the message buffer and other sources.""" # Read unprocessed messages from the msg buffer. news = self._rc.msg_buffer.pop_all() # Store the read messages in your own memory to prevent duplicate processing. - old_messages = self._rc.memory.get() + old_messages = [] if ignore_memory else self._rc.memory.get() self._rc.memory.add_batch(news) # Filter out messages of interest. self._rc.news = [n for n in news if n.cause_by in self._rc.watch and n not in old_messages] From 5c149efee77c6a3c90382de7221f1370eab7d94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Thu, 30 Nov 2023 19:33:27 +0800 Subject: [PATCH 3/4] fixbug: The assumption that messages in 'memory' have been processed has been revoked. --- metagpt/roles/qa_engineer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metagpt/roles/qa_engineer.py b/metagpt/roles/qa_engineer.py index 763ab6a3f..de09cc4f0 100644 --- a/metagpt/roles/qa_engineer.py +++ b/metagpt/roles/qa_engineer.py @@ -167,3 +167,6 @@ class QaEngineer(Role): sent_from=self.profile, send_to=MESSAGE_ROUTE_TO_NONE, ) + + async def _observe(self, ignore_memory=False) -> int: + return await super(QaEngineer, self)._observe(ignore_memory=True) From 053eac62bcd990b748a4ce4578345880d882b276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Fri, 1 Dec 2023 13:01:43 +0800 Subject: [PATCH 4/4] feat: +annotation --- metagpt/roles/qa_engineer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metagpt/roles/qa_engineer.py b/metagpt/roles/qa_engineer.py index de09cc4f0..f2e011ffd 100644 --- a/metagpt/roles/qa_engineer.py +++ b/metagpt/roles/qa_engineer.py @@ -169,4 +169,6 @@ class QaEngineer(Role): ) async def _observe(self, ignore_memory=False) -> int: + # This role has events that trigger and execute themselves based on conditions, and cannot rely on the + # content of memory to activate. return await super(QaEngineer, self)._observe(ignore_memory=True)