mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-03 22:05:35 +02:00
Provide agent specific goals in task, added more example tasks
This commit is contained in:
parent
0c237b76da
commit
57c47c0bcf
2 changed files with 51 additions and 22 deletions
|
@ -17,6 +17,14 @@
|
|||
},
|
||||
"type": "debug"
|
||||
},
|
||||
"debug_different_goal": {
|
||||
"goal": {
|
||||
"0": "Reply to all messages with star emojis when prompted",
|
||||
"1": "Reply to all messages with heart emojis when prompted"
|
||||
},
|
||||
"agent_count": 2,
|
||||
"type": "debug"
|
||||
},
|
||||
"debug_inventory_restriction": {
|
||||
"goal": "Place 1 oak plank, then place 1 stone brick",
|
||||
"initial_inventory": {
|
||||
|
@ -90,6 +98,25 @@
|
|||
"type": "techtree",
|
||||
"timeout": 300
|
||||
},
|
||||
"multiagent_smelt_ingot": {
|
||||
"conversation": "Let's collaborate to smelt ingots",
|
||||
"goal": "Smelt 1 iron ingot and 1 copper ingot, use star emojis in every response",
|
||||
"agent_count": 2,
|
||||
"initial_inventory": {
|
||||
"0": {
|
||||
"furnace": 1,
|
||||
"coal": 2
|
||||
},
|
||||
"1": {
|
||||
"raw_iron": 1,
|
||||
"raw_copper": 1
|
||||
}
|
||||
},
|
||||
"target": "copper_ingot",
|
||||
"number_of_target": 1,
|
||||
"type": "techtree",
|
||||
"timeout": 300
|
||||
},
|
||||
"multiagent_cooking_1": {
|
||||
"conversation": "Let's collaborate to make dinner, I am going to search for 'potatoes' and make 1 'baked_potato', you on the other hand, search for cow and cook 1 beef. We have a furnace (fuel already present) nearby to help us cook, search for it over long distances to find it. Note : We only need one of each item, lets not waste time by collecting unnecessary resources.",
|
||||
"agent_count": 2,
|
||||
|
@ -122,24 +149,5 @@
|
|||
},
|
||||
"blocked_access_to_recipe": [],
|
||||
"goal": "Collaborate to make 1 bread, 1 cooked_mutton"
|
||||
},
|
||||
"multiagent_smelt_ingot": {
|
||||
"conversation": "Let's collaborate to smelt ingots",
|
||||
"goal": "Smelt 1 iron ingot and 1 copper ingot, use star emojis in every response",
|
||||
"agent_count": 2,
|
||||
"initial_inventory": {
|
||||
"0": {
|
||||
"furnace": 1,
|
||||
"coal": 2
|
||||
},
|
||||
"1": {
|
||||
"raw_iron": 1,
|
||||
"raw_copper": 1
|
||||
}
|
||||
},
|
||||
"target": "copper_ingot",
|
||||
"number_of_target": 1,
|
||||
"type": "techtree",
|
||||
"timeout": 300
|
||||
}
|
||||
}
|
||||
}
|
|
@ -150,6 +150,25 @@ export class Task {
|
|||
this.available_agents = settings.profiles.map((p) => JSON.parse(readFileSync(p, 'utf8')).name);
|
||||
}
|
||||
|
||||
getAgentGoal() {
|
||||
if (!this.data || !this.data.goal) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If goal is a string, all agents share the same goal
|
||||
if (typeof this.data.goal === 'string') {
|
||||
return this.data.goal;
|
||||
}
|
||||
|
||||
// If goal is an object, get the goal for this agent's count_id
|
||||
if (typeof this.data.goal === 'object' && this.data.goal !== null) {
|
||||
const agentId = this.agent.count_id.toString();
|
||||
return this.data.goal[agentId] || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
loadTask(task_path, task_id) {
|
||||
try {
|
||||
const tasksFile = readFileSync(task_path, 'utf8');
|
||||
|
@ -242,8 +261,10 @@ export class Task {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.data.goal) {
|
||||
await executeCommand(this.agent, `!goal("${this.data.goal}")`);
|
||||
const agentGoal = this.getAgentGoal();
|
||||
if (agentGoal) {
|
||||
console.log(`Setting goal for agent ${this.agent.count_id}: ${agentGoal}`);
|
||||
await executeCommand(this.agent, `!goal("${agentGoal}")`);
|
||||
}
|
||||
|
||||
if (this.data.conversation && this.agent.count_id === 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue