diff --git a/profiles/_default.json b/profiles/defaults/_default.json similarity index 100% rename from profiles/_default.json rename to profiles/defaults/_default.json diff --git a/profiles/defaults/creative.json b/profiles/defaults/creative.json new file mode 100644 index 0000000..9174ed6 --- /dev/null +++ b/profiles/defaults/creative.json @@ -0,0 +1,14 @@ +{ + "modes": { + "self_preservation": false, + "unstuck": false, + "cowardice": false, + "self_defense": false, + "hunting": false, + "item_collecting": false, + "torch_placing": false, + "elbow_room": true, + "idle_staring": true, + "cheat": false + } +} \ No newline at end of file diff --git a/profiles/defaults/god_mode.json b/profiles/defaults/god_mode.json new file mode 100644 index 0000000..6cecd8c --- /dev/null +++ b/profiles/defaults/god_mode.json @@ -0,0 +1,14 @@ +{ + "modes": { + "self_preservation": false, + "unstuck": false, + "cowardice": false, + "self_defense": false, + "hunting": false, + "item_collecting": false, + "torch_placing": false, + "elbow_room": false, + "idle_staring": true, + "cheat": true + } +} \ No newline at end of file diff --git a/profiles/defaults/survival.json b/profiles/defaults/survival.json new file mode 100644 index 0000000..4504bf9 --- /dev/null +++ b/profiles/defaults/survival.json @@ -0,0 +1,14 @@ +{ + "modes": { + "self_preservation": true, + "unstuck": true, + "cowardice": false, + "self_defense": true, + "hunting": true, + "item_collecting": true, + "torch_placing": true, + "elbow_room": true, + "idle_staring": true, + "cheat": false + } +} \ No newline at end of file diff --git a/settings.js b/settings.js index 89dbd11..3b6c903 100644 --- a/settings.js +++ b/settings.js @@ -10,6 +10,8 @@ export default "mindserver_host": "localhost", "mindserver_port": 8080, + // 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 "profiles": [ "./andy.json", // "./profiles/gpt.json", @@ -23,6 +25,7 @@ export default // "./profiles/deepseek.json", // using more than 1 profile requires you to /msg each bot indivually + // individual profiles override values from the base profile ], "load_memory": false, // load memory from previous session "init_message": "Respond with hello world and your name", // sends to all on spawn diff --git a/src/models/prompter.js b/src/models/prompter.js index 5295653..7b293f2 100644 --- a/src/models/prompter.js +++ b/src/models/prompter.js @@ -24,12 +24,22 @@ export class Prompter { constructor(agent, fp) { this.agent = agent; this.profile = JSON.parse(readFileSync(fp, 'utf8')); - this.default_profile = JSON.parse(readFileSync('./profiles/_default.json', 'utf8')); + let default_profile = JSON.parse(readFileSync('./profiles/defaults/_default.json', 'utf8')); + let base_fp = settings.base_profile; + let base_profile = JSON.parse(readFileSync(base_fp, 'utf8')); - for (let key in this.default_profile) { - if (this.profile[key] === undefined) - this.profile[key] = this.default_profile[key]; + // first use defaults to fill in missing values in the base profile + for (let key in default_profile) { + if (base_profile[key] === undefined) + base_profile[key] = default_profile[key]; } + // then use base profile to fill in missing values in the individual profile + for (let key in base_profile) { + if (this.profile[key] === undefined) + this.profile[key] = base_profile[key]; + } + // base overrides default, individual overrides base + this.convo_examples = null; this.coding_examples = null;