cleaned comments, little fix

This commit is contained in:
MaxRobinsonTheGreat 2024-05-10 12:18:47 -05:00
parent 304fbc807c
commit 76aa9539fb
4 changed files with 7 additions and 4 deletions

View file

@ -63,7 +63,7 @@ export class Agent {
bannedFood: ["rotten_flesh", "spider_eye", "poisonous_potato", "pufferfish", "chicken"]
};
if (save_data && save_data.self_prompt) {
if (save_data && save_data.self_prompt) { // if we're loading memory and self-prompting was on, restart it, ignore init_message
let prompt = save_data.self_prompt;
if (init_message)
prompt = `${init_message}\n${prompt}`;
@ -114,7 +114,7 @@ export class Agent {
}
}
let MAX_ATTEMPTS = 5;
if (!self_prompt && this.self_prompter.on)
if (!self_prompt && this.self_prompter.on) // message from user during self-prompting
MAX_ATTEMPTS = 1; // immediately respond to this message, then let self-prompting take over
for (let i=0; i<MAX_ATTEMPTS; i++) {
if (self_prompt && this.self_prompter.on && this.self_prompter.interrupt) break;

View file

@ -250,7 +250,7 @@ export const actionsList = [
name: '!stopSelfPrompt',
description: 'Stop current action and self-prompting.',
perform: async function (agent) {
agent.self_prompter.stop(); // will stop and
agent.self_prompter.stop();
return 'Self-prompting stopped.';
}
}

View file

@ -46,7 +46,7 @@ export class History {
}
}
async save() {
save() {
// save history object to json file
let data = {
'name': this.name,

View file

@ -51,6 +51,9 @@ export async function craftRecipe(bot, itemName, num=1) {
**/
let placedTable = false;
if (itemName.endsWith('plank'))
itemName += 's'; // catches common mistakes like "oak_plank" instead of "oak_planks"
// get recipes that don't require a crafting table
let recipes = bot.recipesFor(mc.getItemId(itemName), null, 1, null);
let craftingTable = null;