MineDojo / Voyager

An Open-Ended Embodied Agent with Large Language Models
https://voyager.minedojo.org/
MIT License
5.34k stars 491 forks source link

My Bot can not craft anything #164

Closed ChunjiangMonkey closed 23 hours ago

ChunjiangMonkey commented 1 week ago

Before submitting an issue, make sure you read the FAQ.md

Yes.

Briefly describe your issue

I am very excited to run voyager on my MacBook Pro. My robot can collect logs, however it can't make anything, just like planks. looked at the code and found that when the Voyager runs craftItem.js, it gets stuck in the await bot.craft (recipe, count, craftingTable).

Please provide your python, nodejs, Minecraft, and Fabric versions here

python 3.9, node 20.14.0, Minecraft 1.19, Fabric 0.14.18.

[If applicable] Please provide the Minefalyer and Minecraft logs, you can find the log under logs folder

...

[If applicable] Please provide the GPT conversations that are printed each round.

This is the responses of GPT4, who privode the code for voyager to craft planks. Action Agent ai message Explain: The bot already has 6 oak logs in its inventory. It can craft these into planks, and then use the planks to craft a crafting table, which use craftItem().

Plan: 1) Check if the bot has a crafting table in its inventory. If it does, the task is already complete. 2) If the bot does not have a crafting table, check if it has 4 wooden planks in its inventory. 3) If the bot does not have 4 wooden planks, craft them from the oak logs in its inventory. 4) Once the bot has 4 wooden planks, craft a crafting table.

Code:


async function craftCraftingTable(bot) {
  // Check if the bot already has a crafting table
  const craftingTable = bot.inventory.findInventoryItem(mcData.itemsByName["crafting_table"].id);
  if (craftingTable) {
    bot.chat("Already have a crafting table.");
    return;
  }

  // Check if the bot has 4 wooden planks
  const planks = bot.inventory.findInventoryItem(mcData.itemsByName["oak_planks"].id);
  if (!planks || planks.count < 4) {
    // If not, craft them from the oak logs
    bot.chat("Crafting oak planks.");
    await craftItem(bot, "oak_planks", 1);
  }

  // Craft a crafting table
  bot.chat("Crafting crafting table.");
  await craftItem(bot, "crafting_table", 1);
  bot.chat("Crafting table crafted.");
}
ChunjiangMonkey commented 23 hours ago

I have solved this problem. The reason is that I used outdated version of mineflayer. In addition, I would like to remind everyone that Voyager may encounter the problem of skill not being able to write to the database on Windows. The solution is to upgrade the version of chromadb.