🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
feat: merge RFC 116
莘权 马2d93ff28f437
diff --cc metagpt/roles/engineer.pyindex 3cf1f2125,ffd96849b..3982ed67c--- a/metagpt/roles/engineer.py+++ b/metagpt/roles/engineer.py@@@ -82,35 -197,19 +82,33 @@@ class Engineer(Role)except Exception as e:logger.error("code review failed!", e)pass- file_path = self.write_file(todo, code)- msg = Message(content=code, role=self.profile, cause_by=WriteCode)+ await src_file_repo.save(+ coding_context.filename,+ dependencies={coding_context.design_doc.root_relative_path, coding_context.task_doc.root_relative_path},+ content=coding_context.code_doc.content,+ )+ msg = Message(+ content=coding_context.json(), instruct_content=coding_context, role=self.profile, cause_by=WriteCode+ )self._rc.memory.add(msg)- code_msg = todo + FILENAME_CODE_SEP + str(file_path)- code_msg_all.append(code_msg)+ changed_files.add(coding_context.code_doc.filename)+ if not changed_files:+ logger.info("Nothing has changed.")+ return changed_files++ async def _act(self) -> Message:+ """Determines the mode of action based on whether code review is used."""+ changed_files = await self._act_sp_precision(review=self.use_code_review)+ # Unit tests only.+ if CONFIG.REQA_FILENAME and CONFIG.REQA_FILENAME not in changed_files:+ changed_files.add(CONFIG.REQA_FILENAME)- from metagpt.roles import QaEngineer # Avoid circular references.-- logger.info(f"Done {self.get_workspace()} generating.")msg = Message(- content=MSG_SEP.join(code_msg_all),+ content="\n".join(changed_files),role=self.profile,- cause_by=self._rc.todo,+ cause_by=WriteCodeReview if self.use_code_review else WriteCode,- send_to=QaEngineer,+ send_to="Edward", # name of QaEngineer)return msg