mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-26 17:03:45 +02:00
fixing weird conversation thing maybe
This commit is contained in:
parent
1331239830
commit
0bffe111b1
2 changed files with 18 additions and 16 deletions
|
@ -423,10 +423,24 @@ export class Task {
|
||||||
console.log(`Setting goal for agent ${this.agent.count_id}: ${agentGoal}`);
|
console.log(`Setting goal for agent ${this.agent.count_id}: ${agentGoal}`);
|
||||||
}
|
}
|
||||||
await executeCommand(this.agent, `!goal("${agentGoal}")`);
|
await executeCommand(this.agent, `!goal("${agentGoal}")`);
|
||||||
|
|
||||||
|
if (this.data.conversation && this.agent.count_id === 0) {
|
||||||
|
let other_name = this.available_agents.filter(n => n !== this.name)[0];
|
||||||
|
let waitCount = 0;
|
||||||
|
while (other_name === undefined && waitCount < 20) {
|
||||||
|
other_name = this.available_agents.filter(n => n !== this.name)[0];
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
waitCount++;
|
||||||
|
}
|
||||||
|
if (other_name === undefined && this.data.agent_count > 1) {
|
||||||
|
console.log('No other agents found. Task unsuccessful.');
|
||||||
|
this.agent.killAll();
|
||||||
|
}
|
||||||
|
await executeCommand(this.agent, `!startConversation("${other_name}", "${this.data.conversation}")`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async initBotTask() {
|
async initBotTask() {
|
||||||
await this.setAgentGoal();
|
|
||||||
await this.agent.bot.chat(`/clear ${this.name}`);
|
await this.agent.bot.chat(`/clear ${this.name}`);
|
||||||
console.log(`Cleared ${this.name}'s inventory.`);
|
console.log(`Cleared ${this.name}'s inventory.`);
|
||||||
|
|
||||||
|
@ -511,21 +525,8 @@ export class Task {
|
||||||
this.agent.killAll();
|
this.agent.killAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
if (this.data.conversation && this.agent.count_id === 0) {
|
await this.setAgentGoal();
|
||||||
let other_name = this.available_agents.filter(n => n !== this.name)[0];
|
|
||||||
let waitCount = 0;
|
|
||||||
while (other_name === undefined && waitCount < 20) {
|
|
||||||
other_name = this.available_agents.filter(n => n !== this.name)[0];
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
||||||
waitCount++;
|
|
||||||
}
|
|
||||||
if (other_name === undefined && this.data.agent_count > 1) {
|
|
||||||
console.log('No other agents found. Task unsuccessful.');
|
|
||||||
this.agent.killAll();
|
|
||||||
}
|
|
||||||
await executeCommand(this.agent, `!startConversation("${other_name}", "${this.data.conversation}")`);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ export class VLLM {
|
||||||
try {
|
try {
|
||||||
console.log('Awaiting openai api response...')
|
console.log('Awaiting openai api response...')
|
||||||
// console.log('Messages:', messages);
|
// console.log('Messages:', messages);
|
||||||
|
// todo set max_tokens, temperature, top_p, etc. in pack
|
||||||
let completion = await this.vllm.chat.completions.create(pack);
|
let completion = await this.vllm.chat.completions.create(pack);
|
||||||
if (completion.choices[0].finish_reason == 'length')
|
if (completion.choices[0].finish_reason == 'length')
|
||||||
throw new Error('Context length exceeded');
|
throw new Error('Context length exceeded');
|
||||||
|
|
Loading…
Add table
Reference in a new issue