moved main params to settings

This commit is contained in:
MaxRobinsonTheGreat 2024-05-29 21:33:29 -05:00
parent fc3ee6f691
commit 0e251a7588
4 changed files with 19 additions and 9 deletions

View file

@ -1,10 +1,9 @@
import { AgentProcess } from './src/process/agent-process.js'; 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']; let profiles = settings.profiles;
let load_memory = settings.load_memory;
profiles = ['./profiles/llama.json']; let init_message = settings.init_message;
let load_memory = false;
let init_message = 'Say hello world and your name.';
for (let profile of profiles) for (let profile of profiles)
new AgentProcess().start(profile, load_memory, init_message); new AgentProcess().start(profile, load_memory, init_message);

View file

@ -3,5 +3,14 @@
"host": "127.0.0.1", "host": "127.0.0.1",
"port": 55916, "port": 55916,
"auth": "offline", "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"
} }

View file

@ -6,6 +6,7 @@ import { initBot } from '../utils/mcdata.js';
import { containsCommand, commandExists, executeCommand, truncCommandMessage } from './commands/index.js'; import { containsCommand, commandExists, executeCommand, truncCommandMessage } from './commands/index.js';
import { NPCContoller } from './npc/controller.js'; import { NPCContoller } from './npc/controller.js';
import { MemoryBank } from './memory_bank.js'; import { MemoryBank } from './memory_bank.js';
import settings from '../settings.js';
export class Agent { export class Agent {
@ -42,7 +43,8 @@ export class Agent {
"Set the weather to", "Set the weather to",
"Gamerule " "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 (username === this.name) return;
if (ignore_messages.some((m) => message.startsWith(m))) return; if (ignore_messages.some((m) => message.startsWith(m))) return;

View file

@ -137,8 +137,8 @@ export class Coder {
return {success: false, message: null, interrupted: false, timedout: false}; return {success: false, message: null, interrupted: false, timedout: false};
} }
code_return = await this.execute(async ()=>{ 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) if (code_return.interrupted && !code_return.timedout)
return {success: false, message: null, interrupted: true, timedout: false}; return {success: false, message: null, interrupted: true, timedout: false};