diff --git a/main.js b/main.js index fca4d42..8bdf550 100644 --- a/main.js +++ b/main.js @@ -1,10 +1,9 @@ import { AgentProcess } from './src/process/agent-process.js'; +import settings from './src/settings.js'; -let profiles = ['./profiles/gpt.json', './profiles/claude.json', './profiles/llama.json', './profiles/gemini.json']; - -profiles = ['./profiles/llama.json']; -let load_memory = false; -let init_message = 'Say hello world and your name.'; +let profiles = settings.profiles; +let load_memory = settings.load_memory; +let init_message = settings.init_message; for (let profile of profiles) new AgentProcess().start(profile, load_memory, init_message); \ No newline at end of file diff --git a/settings.json b/settings.json index b6dfda7..cb5ce27 100644 --- a/settings.json +++ b/settings.json @@ -3,5 +3,14 @@ "host": "127.0.0.1", "port": 55916, "auth": "offline", - "allow_insecure_coding": true + "allow_insecure_coding": true, + "code_timeout_mins": 10, + + "profiles": [ + "./profiles/gpt.json", + "./profiles/llama.json" + ], + "load_memory": false, + "init_message": "Say hello world and your name" + } \ No newline at end of file diff --git a/src/agent/agent.js b/src/agent/agent.js index 9b4e986..478e825 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -6,6 +6,7 @@ import { initBot } from '../utils/mcdata.js'; import { containsCommand, commandExists, executeCommand, truncCommandMessage } from './commands/index.js'; import { NPCContoller } from './npc/controller.js'; import { MemoryBank } from './memory_bank.js'; +import settings from '../settings.js'; export class Agent { @@ -42,7 +43,8 @@ export class Agent { "Set the weather to", "Gamerule " ]; - this.bot.on('whisper', (username, message) => { + const eventname = settings.profiles.length > 1 ? 'whisper' : 'chat'; + this.bot.on(eventname, (username, message) => { if (username === this.name) return; if (ignore_messages.some((m) => message.startsWith(m))) return; diff --git a/src/agent/coder.js b/src/agent/coder.js index e5a0447..47a7ae8 100644 --- a/src/agent/coder.js +++ b/src/agent/coder.js @@ -137,8 +137,8 @@ export class Coder { return {success: false, message: null, interrupted: false, timedout: false}; } code_return = await this.execute(async ()=>{ - return await execution_file.main(this.agent.bot, -1); - }); + return await execution_file.main(this.agent.bot); + }, settings.code_timeout_mins); if (code_return.interrupted && !code_return.timedout) return {success: false, message: null, interrupted: true, timedout: false};