diff --git a/src/agent/commands/actions.js b/src/agent/commands/actions.js index ff695f7..19b231e 100644 --- a/src/agent/commands/actions.js +++ b/src/agent/commands/actions.js @@ -1,7 +1,6 @@ import * as skills from '../library/skills.js'; import settings from '../../../settings.js'; import convoManager from '../conversation.js'; -import { load } from 'cheerio'; function runAsAction (actionFn, resume = false, timeout = -1) { let actionLabel = null; // Will be set on first use @@ -355,35 +354,6 @@ export const actionsList = [ return `Mode ${mode_name} is now ${on ? 'on' : 'off'}.`; } }, - { - name: '!searchWiki', - description: 'Search the Minecraft Wiki for the given query.', - params: { - 'query': { type: 'string', description: 'The query to search for.' } - }, - perform: async function (agent, query) { - const url = `https://minecraft.wiki/w/${query}` - try { - const response = await fetch(url); - if (response.status === 404) { - return `${query} was not found on the Minecraft Wiki. Try adjusting your search term.`; - } - const html = await response.text(); - const $ = load(html); - - const parserOutput = $("div.mw-parser-output"); - - parserOutput.find("table.navbox").remove(); - - const divContent = parserOutput.text(); - - return divContent.trim(); - } catch (error) { - console.error("Error fetching or parsing HTML:", error); - return `The following error occured: ${error}` - } - } - }, { name: '!goal', description: 'Set a goal prompt to endlessly work towards with continuous self-prompting.', diff --git a/src/agent/commands/queries.js b/src/agent/commands/queries.js index c9fe333..a23bb9b 100644 --- a/src/agent/commands/queries.js +++ b/src/agent/commands/queries.js @@ -2,6 +2,7 @@ import * as world from '../library/world.js'; import * as mc from '../../utils/mcdata.js'; import { getCommandDocs } from './index.js'; import convoManager from '../conversation.js'; +import { load } from 'cheerio'; const pad = (str) => { return '\n' + str + '\n'; @@ -214,6 +215,35 @@ export const queryList = [ return pad(craftingPlan); }, }, + { + name: '!searchWiki', + description: 'Search the Minecraft Wiki for the given query.', + params: { + 'query': { type: 'string', description: 'The query to search for.' } + }, + perform: async function (agent, query) { + const url = `https://minecraft.wiki/w/${query}` + try { + const response = await fetch(url); + if (response.status === 404) { + return `${query} was not found on the Minecraft Wiki. Try adjusting your search term.`; + } + const html = await response.text(); + const $ = load(html); + + const parserOutput = $("div.mw-parser-output"); + + parserOutput.find("table.navbox").remove(); + + const divContent = parserOutput.text(); + + return divContent.trim(); + } catch (error) { + console.error("Error fetching or parsing HTML:", error); + return `The following error occured: ${error}` + } + } + }, { name: '!help', description: 'Lists all available commands and their descriptions.',