mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-04 21:33:03 +02:00
added searchwiki action
This commit is contained in:
parent
6e73f30f7f
commit
76204664cd
4 changed files with 30 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
||||||
"@huggingface/inference": "^2.8.1",
|
"@huggingface/inference": "^2.8.1",
|
||||||
"@mistralai/mistralai": "^1.1.0",
|
"@mistralai/mistralai": "^1.1.0",
|
||||||
"canvas": "^3.1.0",
|
"canvas": "^3.1.0",
|
||||||
|
"cheerio": "^1.0.0",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"google-translate-api-x": "^10.7.1",
|
"google-translate-api-x": "^10.7.1",
|
||||||
"groq-sdk": "^0.15.0",
|
"groq-sdk": "^0.15.0",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gemini",
|
"name": "gemini",
|
||||||
|
|
||||||
"model": "gemini-1.5-flash",
|
"model": "gemini-2.0-flash",
|
||||||
|
|
||||||
"cooldown": 10000
|
"cooldown": 10000
|
||||||
}
|
}
|
|
@ -13,10 +13,10 @@ export default
|
||||||
// the base profile is shared by all bots for default prompts/examples/modes
|
// the base profile is shared by all bots for default prompts/examples/modes
|
||||||
"base_profile": "./profiles/defaults/survival.json", // also see creative.json, god_mode.json
|
"base_profile": "./profiles/defaults/survival.json", // also see creative.json, god_mode.json
|
||||||
"profiles": ((process.env.PROFILES) && JSON.parse(process.env.PROFILES)) || [
|
"profiles": ((process.env.PROFILES) && JSON.parse(process.env.PROFILES)) || [
|
||||||
"./andy.json",
|
// "./andy.json",
|
||||||
// "./profiles/gpt.json",
|
// "./profiles/gpt.json",
|
||||||
// "./profiles/claude.json",
|
// "./profiles/claude.json",
|
||||||
// "./profiles/gemini.json",
|
"./profiles/gemini.json",
|
||||||
// "./profiles/llama.json",
|
// "./profiles/llama.json",
|
||||||
// "./profiles/qwen.json",
|
// "./profiles/qwen.json",
|
||||||
// "./profiles/mistral.json",
|
// "./profiles/mistral.json",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as skills from '../library/skills.js';
|
import * as skills from '../library/skills.js';
|
||||||
import settings from '../../../settings.js';
|
import settings from '../../../settings.js';
|
||||||
import convoManager from '../conversation.js';
|
import convoManager from '../conversation.js';
|
||||||
|
import { load } from 'cheerio';
|
||||||
|
|
||||||
function runAsAction (actionFn, resume = false, timeout = -1) {
|
function runAsAction (actionFn, resume = false, timeout = -1) {
|
||||||
let actionLabel = null; // Will be set on first use
|
let actionLabel = null; // Will be set on first use
|
||||||
|
@ -354,6 +355,31 @@ export const actionsList = [
|
||||||
return `Mode ${mode_name} is now ${on ? 'on' : 'off'}.`;
|
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 divContent = $("div.mw-parser-output").text();
|
||||||
|
|
||||||
|
return divContent.trim();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching or parsing HTML:", error);
|
||||||
|
return `The following error occured: ${error}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '!goal',
|
name: '!goal',
|
||||||
description: 'Set a goal prompt to endlessly work towards with continuous self-prompting.',
|
description: 'Set a goal prompt to endlessly work towards with continuous self-prompting.',
|
||||||
|
|
Loading…
Add table
Reference in a new issue