From 2ec2e71c4d3013635574785072aa69ba7ac7cd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 8 Jan 2024 17:38:53 +0800 Subject: [PATCH 1/7] fixbug: rename folder does not work in windows os --- metagpt/roles/engineer.py | 3 ++- metagpt/utils/git_repository.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.py index e05e69cbb..b2a909400 100644 --- a/metagpt/roles/engineer.py +++ b/metagpt/roles/engineer.py @@ -204,7 +204,8 @@ class Engineer(Role): async def _think(self) -> Action | None: if not CONFIG.src_workspace: - CONFIG.src_workspace = CONFIG.git_repo.workdir / CONFIG.git_repo.workdir.name + project_name = CONFIG.project_name or CONFIG.git_repo.workdir.name + CONFIG.src_workspace = CONFIG.git_repo.workdir / project_name write_code_filters = any_to_str_set([WriteTasks, SummarizeCode, FixBug]) summarize_code_filters = any_to_str_set([WriteCode, WriteCodeReview]) if not self.rc.news: diff --git a/metagpt/utils/git_repository.py b/metagpt/utils/git_repository.py index e9855df05..4feed89d5 100644 --- a/metagpt/utils/git_repository.py +++ b/metagpt/utils/git_repository.py @@ -199,10 +199,17 @@ class GitRepository: if new_path.exists(): logger.info(f"Delete directory {str(new_path)}") shutil.rmtree(new_path) + if new_path.exists(): # Recheck for windows os + logger.warning(f"Failed to delete directory {str(new_path)}") + return try: shutil.move(src=str(self.workdir), dst=str(new_path)) except Exception as e: logger.warning(f"Move {str(self.workdir)} to {str(new_path)} error: {e}") + finally: + if not new_path.exists(): # Recheck for windows os + logger.warning(f"Failed to move {str(self.workdir)} to {str(new_path)}") + return logger.info(f"Rename directory {str(self.workdir)} to {str(new_path)}") self._repository = Repo(new_path) self._gitignore_rules = parse_gitignore(full_path=str(new_path / ".gitignore")) From 12ac57af4c66bfb0e92e36120d65eccc9af77e2d Mon Sep 17 00:00:00 2001 From: shenchucheng Date: Mon, 8 Jan 2024 20:54:52 +0800 Subject: [PATCH 2/7] release 0.6.3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 10938c769..d997b5f62 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pr setup( name="metagpt", - version="0.6.2", + version="0.6.3", description="The Multi-Agent Framework", long_description=long_description, long_description_content_type="text/markdown", From 0788080e205a5437f1974f77b4a203f0b57d1f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Wed, 10 Jan 2024 19:51:38 +0800 Subject: [PATCH 3/7] fixbug: fix todo_description --- metagpt/roles/role.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 3bcd600fc..3d5e55057 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -504,7 +504,13 @@ class Role(SerializationMixin, is_polymorphic_base=True): @property def todo(self) -> str: - """AgentStore uses this attribute to display to the user what actions the current role should take.""" + """ + AgentStore uses this attribute to display to the user what actions the current role should take. + """ + if self.rc.todo: + if self.rc.todo.desc: + return self.rc.todo.desc + return any_to_name(self.rc.todo) if self.actions: return any_to_name(self.actions[0]) return "" From cf2366b72ce2f5fcc8f5a283733eb48f35cf1c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Wed, 10 Jan 2024 21:13:36 +0800 Subject: [PATCH 4/7] feat: +ver --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d997b5f62..ea84fe299 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pr setup( name="metagpt", - version="0.6.3", + version="0.6.4", description="The Multi-Agent Framework", long_description=long_description, long_description_content_type="text/markdown", From 29d8326c06899535bb2d8953246aa30466b8f72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Wed, 10 Jan 2024 21:13:36 +0800 Subject: [PATCH 5/7] feat: +ver feat: Moderation + llm arg feat: +log --- metagpt/document_store/faiss_store.py | 6 +++++- metagpt/tools/moderation.py | 4 ++-- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/metagpt/document_store/faiss_store.py b/metagpt/document_store/faiss_store.py index 1271f1c23..6f97141c2 100644 --- a/metagpt/document_store/faiss_store.py +++ b/metagpt/document_store/faiss_store.py @@ -40,7 +40,11 @@ class FaissStore(LocalStore): return FAISS.load_local(self.raw_data_path.parent, self.embedding, self.fname) def _write(self, docs, metadatas): - store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas) + try: + store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas) + except Exception as e: + logger.error(f"Failed to write. error: {e}") + raise e return store def persist(self): diff --git a/metagpt/tools/moderation.py b/metagpt/tools/moderation.py index cda164ec5..8effc0e8b 100644 --- a/metagpt/tools/moderation.py +++ b/metagpt/tools/moderation.py @@ -11,8 +11,8 @@ from metagpt.llm import LLM class Moderation: - def __init__(self): - self.llm = LLM() + def __init__(self, llm=None): + self.llm = llm or LLM() def handle_moderation_results(self, results): resp = [] diff --git a/requirements.txt b/requirements.txt index 0a54236f0..f8e4d2585 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ lancedb==0.4.0 langchain==0.0.352 loguru==0.6.0 meilisearch==0.21.0 -numpy==1.24.3 +numpy>=1.24.3 openai==1.6.0 openpyxl beautifulsoup4==4.12.2 diff --git a/setup.py b/setup.py index d997b5f62..ea84fe299 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pr setup( name="metagpt", - version="0.6.3", + version="0.6.4", description="The Multi-Agent Framework", long_description=long_description, long_description_content_type="text/markdown", From b275f1a3f8c33ea5832d1656e26e9e4b8831b631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Tue, 16 Jan 2024 10:45:01 +0800 Subject: [PATCH 6/7] feat: +ver fixbug: RPC think --- metagpt/roles/role.py | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 3d5e55057..36d007f3b 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -494,6 +494,7 @@ class Role(SerializationMixin, is_polymorphic_base=True): async def think(self) -> Action: """The exported `think` function""" + await self._observe() await self._think() return self.rc.todo diff --git a/setup.py b/setup.py index ea84fe299..ca8bb3980 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pr setup( name="metagpt", - version="0.6.4", + version="0.6.5", description="The Multi-Agent Framework", long_description=long_description, long_description_content_type="text/markdown", From 2b522ffccbf48a8f9295793960e1ea02bdbcd927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Wed, 17 Jan 2024 11:55:09 +0800 Subject: [PATCH 7/7] fixbug: engineer action_description --- metagpt/roles/engineer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.py index c83a776c2..7c91ec6f9 100644 --- a/metagpt/roles/engineer.py +++ b/metagpt/roles/engineer.py @@ -297,6 +297,6 @@ class Engineer(Role): self.set_todo(self.summarize_todos[0]) @property - def todo(self) -> str: + def action_description(self) -> str: """AgentStore uses this attribute to display to the user what actions the current role should take.""" return self.next_todo_action