coding interrupt, small fixes

This commit is contained in:
Maximus 2024-04-05 16:58:08 -05:00
parent 8d37dc12d2
commit a620971ed2
3 changed files with 6 additions and 3 deletions

View file

@ -94,11 +94,14 @@ export class Coder {
let code_return = null;
let failures = 0;
const interrupt_return = {success: true, message: null, interrupted: true, timedout: false};
for (let i=0; i<5; i++) {
if (this.agent.bot.interrupt_code)
return {success: true, message: null, interrupted: true, timedout: false};
return interrupt_return;
console.log(messages)
let res = await this.agent.prompter.promptCoding(messages);
if (this.agent.bot.interrupt_code)
return interrupt_return;
let contains_code = res.indexOf('```') !== -1;
if (!contains_code) {
if (res.indexOf('!newAction') !== -1) {

View file

@ -95,7 +95,7 @@ export async function executeCommand(agent, message) {
export function getCommandDocs() {
let docs = `\n*COMMAND DOCS\n You can use the following commands to perform actions and get information about the world.
Use the commands with the syntax: !commandName or !commandName("arg1", 1.2, ...) if the command takes arguments.\n
Do not use codeblocks. Only use one command in each response, trailing commands and comments will be ignored. Use these commands frequently in your responses!\n`;
Do not use codeblocks. Only use one command in each response, trailing commands and comments will be ignored.\n`;
for (let command of commandList) {
docs += command.name + ': ' + command.description + '\n';
if (command.params) {

View file

@ -503,7 +503,7 @@ export async function placeBlock(bot, blockType, x, y, z) {
log(bot, `${blockType} already at ${targetBlock.position}.`);
return false;
}
const empty_blocks = ['air', 'water', 'lava', 'grass', 'tall_grass', 'snow', 'dead_bush', 'fern'];
const empty_blocks = ['air', 'water', 'lava', 'grass', 'short_grass', 'tall_grass', 'snow', 'dead_bush', 'fern'];
if (!empty_blocks.includes(targetBlock.name)) {
log(bot, `${blockType} in the way at ${targetBlock.position}.`);
const removed = await breakBlockAt(bot, x, y, z);