From 682bc0320be883c0539d5f75dec832cf89e3c6f8 Mon Sep 17 00:00:00 2001 From: liangliang Date: Fri, 13 Oct 2023 15:02:44 +0800 Subject: [PATCH 1/4] Mineflayer:set born location to (26,100,20) --- metagpt/mineflayer_env/mineflayer/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metagpt/mineflayer_env/mineflayer/index.js b/metagpt/mineflayer_env/mineflayer/index.js index 02b64ba5a..362318898 100644 --- a/metagpt/mineflayer_env/mineflayer/index.js +++ b/metagpt/mineflayer_env/mineflayer/index.js @@ -51,7 +51,7 @@ app.post("/start", (req, res) => { }); bot.once("spawn", async () => { - mineflayerViewer(bot, { port: 3007, firstPerson: false }) + mineflayerViewer(bot, { port: 3007, firstPerson: false }) bot.removeListener("error", onConnectionFailed); let itemTicks = 1; if (req.body.reset === "hard") { @@ -127,7 +127,7 @@ app.post("/start", (req, res) => { bot.chat(`/spreadplayers ~ ~ 0 300 under 80 false @s`); await bot.waitForTicks(bot.waitTicks); } - + bot.chat(`/spawnpoint bot 26 100 20`); await bot.waitForTicks(bot.waitTicks * itemTicks); res.json(bot.observe()); From 184359b4e445f37e240fbb27305358b9341ba8a8 Mon Sep 17 00:00:00 2001 From: Sirui Hong <34952977+stellaHSR@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:14:02 +0800 Subject: [PATCH 2/4] Update curriculum_agent.py rm self --- metagpt/roles/minecraft/curriculum_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metagpt/roles/minecraft/curriculum_agent.py b/metagpt/roles/minecraft/curriculum_agent.py index 986e03785..76adf67cb 100644 --- a/metagpt/roles/minecraft/curriculum_agent.py +++ b/metagpt/roles/minecraft/curriculum_agent.py @@ -276,7 +276,7 @@ class CurriculumDesigner(Base): task = self.game_memory.current_task elif inventoryUsed >= 33: task = self.generate_task_if_inventory_full( - self, events=events, chest_observation=chest_observation + events=events, chest_observation=chest_observation ) else: task = await DesignTask().run(human_msg, system_msg, *args, **kwargs) From 73325169f65938b16d3cfa0737091e32b21007b5 Mon Sep 17 00:00:00 2001 From: liangliang Date: Fri, 13 Oct 2023 21:52:17 +0800 Subject: [PATCH 3/4] Drawresults: update resume mode to find last round start time --- draw_results.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/draw_results.py b/draw_results.py index 17062c644..7ab704e3f 100644 --- a/draw_results.py +++ b/draw_results.py @@ -4,6 +4,7 @@ import os import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import math +from metagpt.config import CONFIG def extract_logs(filename, start_time=None, end_time=None): with open(filename, 'r') as f: @@ -31,15 +32,16 @@ def extract_time_from_last_round_zero(log_filename): with open(log_filename, 'r') as f: lines = f.readlines() + found = None # 倒序遍历文件的每一行 - for line in reversed(lines): - if "Config loading done" in line: - # 正则表达式匹配年月日 小时:分钟的格式 - match = re.search(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2})', line) - if match: - return match.group(1) + while not found: + for line in reversed(lines): + if "round_id:1\n" in line: + # 正则表达式匹配年月日 小时:分钟的格式 + match = re.search(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2})', line) + if match.group(1): + return match.group(1) return None - def analyze_log_block(logs_block): rounds: list[int] = [] items_collected :list[int] = [] @@ -84,11 +86,11 @@ def analyze_log_block(logs_block): items_collected.append(total_items) if "Completed tasks so far:" in line: - tasks = line.replace("Completed tasks so far:", "").strip().split(", ") + tasks = line.replace("Completed tasks so far:", "").strip().split(";") completed_tasks.append(0 if tasks == ['None'] else len(tasks)) if "Failed tasks that are too hard:" in line: - tasks = line.replace("Failed tasks that are too hard:", "").strip().split(", ") + tasks = line.replace("Failed tasks that are too hard:", "").strip().split(";") failed_tasks.append(0 if tasks == ['None'] else len(tasks)) check_for_info = False round_start = False From 825c343e9d68a3cb50f313db266d4103cf130e17 Mon Sep 17 00:00:00 2001 From: liangliang Date: Fri, 13 Oct 2023 21:57:24 +0800 Subject: [PATCH 4/4] Drawresults: update resume mode to find last round start time --- draw_results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draw_results.py b/draw_results.py index 7ab704e3f..8a9e34d6c 100644 --- a/draw_results.py +++ b/draw_results.py @@ -41,7 +41,7 @@ def extract_time_from_last_round_zero(log_filename): match = re.search(r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2})', line) if match.group(1): return match.group(1) - return None + return None def analyze_log_block(logs_block): rounds: list[int] = [] items_collected :list[int] = []