mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-09 16:55:34 +02:00
impoved initialization and logging
This commit is contained in:
parent
768d1da1bb
commit
2c0467b658
8 changed files with 16 additions and 20 deletions
3
main.js
3
main.js
|
@ -19,7 +19,7 @@ function getProfiles(args) {
|
||||||
return args.profiles || settings.profiles;
|
return args.profiles || settings.profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
async function main() {
|
||||||
if (settings.host_mindserver) {
|
if (settings.host_mindserver) {
|
||||||
const mindServer = createMindServer();
|
const mindServer = createMindServer();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ function main() {
|
||||||
for (let i=0; i<profiles.length; i++) {
|
for (let i=0; i<profiles.length; i++) {
|
||||||
const agent = new AgentProcess();
|
const agent = new AgentProcess();
|
||||||
agent.start(profiles[i], load_memory, init_message, i);
|
agent.start(profiles[i], load_memory, init_message, i);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
mandy.json
Normal file
6
mandy.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "mandy",
|
||||||
|
|
||||||
|
"model": "gpt-4o-2024-11-20"
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"name": "randy",
|
|
||||||
|
|
||||||
"model": "gpt-4o-mini"
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ export default
|
||||||
|
|
||||||
"profiles": [
|
"profiles": [
|
||||||
"./andy.json",
|
"./andy.json",
|
||||||
"./randy.json",
|
"./mandy.json",
|
||||||
// "./profiles/gpt.json",
|
// "./profiles/gpt.json",
|
||||||
// "./profiles/claude.json",
|
// "./profiles/claude.json",
|
||||||
// "./profiles/gemini.json",
|
// "./profiles/gemini.json",
|
||||||
|
|
|
@ -43,15 +43,13 @@ export class Agent {
|
||||||
this.memory_bank = new MemoryBank();
|
this.memory_bank = new MemoryBank();
|
||||||
console.log('Initializing self prompter...');
|
console.log('Initializing self prompter...');
|
||||||
this.self_prompter = new SelfPrompter(this);
|
this.self_prompter = new SelfPrompter(this);
|
||||||
initConversationManager(this);
|
initConversationManager(this);
|
||||||
|
|
||||||
// After getting the name, register with MindServer via proxy
|
|
||||||
serverProxy.registerAgent(this.name);
|
|
||||||
|
|
||||||
console.log('Initializing examples...');
|
console.log('Initializing examples...');
|
||||||
await this.prompter.initExamples();
|
await this.prompter.initExamples();
|
||||||
|
|
||||||
console.log('Logging into minecraft...');
|
serverProxy.registerAgent(this.name);
|
||||||
|
|
||||||
|
console.log(this.name, 'logging into minecraft...');
|
||||||
this.bot = initBot(this.name);
|
this.bot = initBot(this.name);
|
||||||
|
|
||||||
initModes(this);
|
initModes(this);
|
||||||
|
|
|
@ -293,7 +293,7 @@ export function shouldPlaceTorch(bot) {
|
||||||
if (!nearest_torch) {
|
if (!nearest_torch) {
|
||||||
const block = bot.blockAt(pos);
|
const block = bot.blockAt(pos);
|
||||||
let has_torch = bot.inventory.items().find(item => item.name === 'torch');
|
let has_torch = bot.inventory.items().find(item => item.name === 'torch');
|
||||||
return has_torch && block.name === 'air';
|
return has_torch && block?.name === 'air';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,6 @@ export class Prompter {
|
||||||
}
|
}
|
||||||
|
|
||||||
async initExamples() {
|
async initExamples() {
|
||||||
console.log('initializing examples...');
|
|
||||||
try {
|
try {
|
||||||
this.convo_examples = new Examples(this.embedding_model);
|
this.convo_examples = new Examples(this.embedding_model);
|
||||||
this.coding_examples = new Examples(this.embedding_model);
|
this.coding_examples = new Examples(this.embedding_model);
|
||||||
|
@ -151,8 +150,8 @@ export class Prompter {
|
||||||
this.convo_examples.load(this.profile.conversation_examples),
|
this.convo_examples.load(this.profile.conversation_examples),
|
||||||
this.coding_examples.load(this.profile.coding_examples)
|
this.coding_examples.load(this.profile.coding_examples)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.log('done initializing examples.');
|
console.log('Examples initialized.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to initialize examples:', error);
|
console.error('Failed to initialize examples:', error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -34,7 +34,6 @@ export class Examples {
|
||||||
if (!this.model) return; // Early return if no embedding model
|
if (!this.model) return; // Early return if no embedding model
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('embedding examples...');
|
|
||||||
// Create array of promises first
|
// Create array of promises first
|
||||||
const embeddingPromises = examples.map(example => {
|
const embeddingPromises = examples.map(example => {
|
||||||
const turn_text = this.turnsToText(example);
|
const turn_text = this.turnsToText(example);
|
||||||
|
@ -46,7 +45,6 @@ export class Examples {
|
||||||
|
|
||||||
// Wait for all embeddings to complete
|
// Wait for all embeddings to complete
|
||||||
await Promise.all(embeddingPromises);
|
await Promise.all(embeddingPromises);
|
||||||
console.log('done embedding examples.');
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('Error with embedding model, using word overlap instead:', err);
|
console.warn('Error with embedding model, using word overlap instead:', err);
|
||||||
this.model = null;
|
this.model = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue