From 84cb2fa3db92b4d9ab97b53d0551c303c224e411 Mon Sep 17 00:00:00 2001 From: stellahsr Date: Sat, 7 Oct 2023 11:09:54 +0800 Subject: [PATCH] update code: directly get events instead of request mc bug fix: human_msg and system_msg assignment --- metagpt/actions/minecraft/generate_actions.py | 2 +- metagpt/roles/minecraft/curriculum_agent.py | 3 ++- metagpt/roles/minecraft/skill_manager.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/metagpt/actions/minecraft/generate_actions.py b/metagpt/actions/minecraft/generate_actions.py index 588f733cf..65433f326 100644 --- a/metagpt/actions/minecraft/generate_actions.py +++ b/metagpt/actions/minecraft/generate_actions.py @@ -22,7 +22,7 @@ class GenerateActionCode(Action): Implement the logic for generating action code here. """ - logger.info(f"human_msg {human_msg}, system_msg {system_msg}") + # logger.info(f"human_msg {human_msg}, system_msg {system_msg}") rsp = await self._aask(prompt=human_msg, system_msgs=system_msg) parsed_result = parse_action_response(rsp) # logger.info(f"parsed_result is HERE: {parsed_result}") diff --git a/metagpt/roles/minecraft/curriculum_agent.py b/metagpt/roles/minecraft/curriculum_agent.py index 95d39afbb..68e394786 100644 --- a/metagpt/roles/minecraft/curriculum_agent.py +++ b/metagpt/roles/minecraft/curriculum_agent.py @@ -313,7 +313,8 @@ class CurriculumDesigner(Base): logger.debug(f"Todo is {todo}") self.maintain_actions(todo) # 获取最新的游戏周边环境信息 - events = await self._obtain_events() + # events = await self._obtain_events() + events = self.game_memory.event chest_observation = self.game_memory.chest_observation # DesignCurriculum.set_qa_cache(self.game_memory.qa_cache) diff --git a/metagpt/roles/minecraft/skill_manager.py b/metagpt/roles/minecraft/skill_manager.py index d55b5f968..161ec08ae 100644 --- a/metagpt/roles/minecraft/skill_manager.py +++ b/metagpt/roles/minecraft/skill_manager.py @@ -36,8 +36,8 @@ class SkillManager(Base): ) def encapsule_message(self, program_code, program_name, *args, **kwargs): - human_msg = self.render_system_message(load_prompt("skill")) - system_msg = self.render_human_message( + system_msg = self.render_system_message(load_prompt("skill")) + human_msg = self.render_human_message( program_code + "\n\n" + f"The main function is `{program_name}`." ) return {"system_msg": [system_msg.content], "human_msg": human_msg.content}