From a3d7b0f380c8305ce51f0675af74d2e438b7e2b0 Mon Sep 17 00:00:00 2001 From: geekan Date: Fri, 15 Dec 2023 13:19:04 +0800 Subject: [PATCH] CR update --- metagpt/actions/action.py | 1 - metagpt/actions/action_node.py | 3 ++- metagpt/actions/research.py | 2 +- metagpt/actions/summarize_code.py | 14 +++++++------- metagpt/roles/role.py | 16 ---------------- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py index 6c1f63f45..1534b1f4d 100644 --- a/metagpt/actions/action.py +++ b/metagpt/actions/action.py @@ -43,7 +43,6 @@ class Action(ABC): """Set prefix for later usage""" self.prefix = prefix self.profile = profile - self.llm.system_prompt = prefix return self def __str__(self): diff --git a/metagpt/actions/action_node.py b/metagpt/actions/action_node.py index 1d808ec70..fb7d621d8 100644 --- a/metagpt/actions/action_node.py +++ b/metagpt/actions/action_node.py @@ -70,7 +70,8 @@ class ActionNode: content: str instruct_content: BaseModel - def __init__(self, key, expected_type, instruction, example, content="", children=None): + def __init__(self, key: str, expected_type: Type, instruction: str, example: str, content: str = "", + children: dict[str, "ActionNode"] = None): self.key = key self.expected_type = expected_type self.instruction = instruction diff --git a/metagpt/actions/research.py b/metagpt/actions/research.py index d7a2a7e38..a70038c51 100644 --- a/metagpt/actions/research.py +++ b/metagpt/actions/research.py @@ -114,7 +114,7 @@ class CollectLinks(Action): keywords = OutputParser.extract_struct(keywords, list) keywords = parse_obj_as(list[str], keywords) except Exception as e: - logger.exception(f'fail to get keywords related to the research topic "{topic}" for {e}') + logger.exception(f"fail to get keywords related to the research topic '{topic}' for {e}") keywords = [topic] results = await asyncio.gather(*(self.search_engine.run(i, as_string=False) for i in keywords)) diff --git a/metagpt/actions/summarize_code.py b/metagpt/actions/summarize_code.py index 413ac2a21..f8d8d2b47 100644 --- a/metagpt/actions/summarize_code.py +++ b/metagpt/actions/summarize_code.py @@ -34,13 +34,13 @@ ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenc ----- {code_blocks} -## Code Review All: 请你对历史所有文件进行阅读,在文件中找到可能的bug,如函数未实现、调用错误、未引用等 +## Code Review All: Please read all historical files and find possible bugs in the files, such as unimplemented functions, calling errors, unreferences, etc. -## Call flow: mermaid代码,根据实现的函数,使用mermaid绘制完整的调用链 +## Call flow: mermaid code, based on the implemented function, use mermaid to draw a complete call chain -## Summary: 根据历史文件的实现情况进行总结 +## Summary: Summary based on the implementation of historical files -## TODOs: Python dict[str, str],这里写出需要修改的文件列表与理由,我们会在之后进行修改 +## TODOs: Python dict[str, str], write down the list of files that need to be modified and the reasons. We will modify them later. """ @@ -49,9 +49,9 @@ FORMAT_EXAMPLE = """ ## Code Review All ### a.py -- 它少实现了xxx需求... -- 字段yyy没有给出... -- ... +- It fulfills less of xxx requirements... +- Field yyy is not given... +-... ### b.py ... diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index b673c330d..b07541b09 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -218,22 +218,6 @@ class Role: if env: env.set_subscription(self, self._subscription) - # # Replaced by FileRepository.set_file - # def set_doc(self, content: str, filename: str): - # return self._rc.env.set_doc(content, filename) - # - # # Replaced by FileRepository.get_file - # def get_doc(self, filename: str): - # return self._rc.env.get_doc(filename) - # - # # Replaced by CONFIG.xx - # def set(self, k, v): - # return self._rc.env.set(k, v) - # - # # Replaced by CONFIG.xx - # def get(self, k): - # return self._rc.env.get(k) - @property def profile(self): """Get the role description (position)"""