impoved initialization and logging

This commit is contained in:
MaxRobinsonTheGreat 2024-11-25 17:15:23 -06:00
parent 768d1da1bb
commit 2c0467b658
8 changed files with 16 additions and 20 deletions

View file

@ -19,7 +19,7 @@ function getProfiles(args) {
return args.profiles || settings.profiles;
}
function main() {
async function main() {
if (settings.host_mindserver) {
const mindServer = createMindServer();
}
@ -32,6 +32,7 @@ function main() {
for (let i=0; i<profiles.length; i++) {
const agent = new AgentProcess();
agent.start(profiles[i], load_memory, init_message, i);
await new Promise(resolve => setTimeout(resolve, 1000));
}
}

6
mandy.json Normal file
View file

@ -0,0 +1,6 @@
{
"name": "mandy",
"model": "gpt-4o-2024-11-20"
}

View file

@ -1,6 +0,0 @@
{
"name": "randy",
"model": "gpt-4o-mini"
}

View file

@ -12,7 +12,7 @@ export default
"profiles": [
"./andy.json",
"./randy.json",
"./mandy.json",
// "./profiles/gpt.json",
// "./profiles/claude.json",
// "./profiles/gemini.json",

View file

@ -43,15 +43,13 @@ export class Agent {
this.memory_bank = new MemoryBank();
console.log('Initializing self prompter...');
this.self_prompter = new SelfPrompter(this);
initConversationManager(this);
// After getting the name, register with MindServer via proxy
serverProxy.registerAgent(this.name);
initConversationManager(this);
console.log('Initializing examples...');
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);
initModes(this);

View file

@ -293,7 +293,7 @@ export function shouldPlaceTorch(bot) {
if (!nearest_torch) {
const block = bot.blockAt(pos);
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;
}

View file

@ -141,7 +141,6 @@ export class Prompter {
}
async initExamples() {
console.log('initializing examples...');
try {
this.convo_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.coding_examples.load(this.profile.coding_examples)
]);
console.log('done initializing examples.');
console.log('Examples initialized.');
} catch (error) {
console.error('Failed to initialize examples:', error);
throw error;

View file

@ -34,7 +34,6 @@ export class Examples {
if (!this.model) return; // Early return if no embedding model
try {
console.log('embedding examples...');
// Create array of promises first
const embeddingPromises = examples.map(example => {
const turn_text = this.turnsToText(example);
@ -46,7 +45,6 @@ export class Examples {
// Wait for all embeddings to complete
await Promise.all(embeddingPromises);
console.log('done embedding examples.');
} catch (err) {
console.warn('Error with embedding model, using word overlap instead:', err);
this.model = null;