From 09a902c1b2e2018fe03528af3afe30a23a66ae5d Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Thu, 16 Jan 2025 16:26:20 +0800 Subject: [PATCH] fix: intentory empty issue --- services/minecraft/src/prompts/agent.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/minecraft/src/prompts/agent.ts b/services/minecraft/src/prompts/agent.ts index f93e2e8bc..bca4b8a10 100644 --- a/services/minecraft/src/prompts/agent.ts +++ b/services/minecraft/src/prompts/agent.ts @@ -23,6 +23,17 @@ If I command you 'stop', then call the 'stop' function. export async function genStatusPrompt(mineflayer: Mineflayer): Promise { const inventory = await listInventory(mineflayer) + if (inventory.length === 0) { + return `I will give you the following information: +${mineflayer.status.toOneLiner()} + +Inventory: +[Empty] + +Item in hand: +[Empty] +` + } const inventoryStr = inventory.map(item => `${item.name} x ${item.count}`).join(', ') const itemInHand = `${inventory[0].name} x ${inventory[0].count}` // TODO: mock