fixing weird conversation thing maybe

This commit is contained in:
Isadora White 2025-06-01 18:43:28 -05:00
parent 1331239830
commit 0bffe111b1
2 changed files with 18 additions and 16 deletions

View file

@ -423,10 +423,24 @@ export class Task {
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) {
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() {
await this.setAgentGoal();
await this.agent.bot.chat(`/clear ${this.name}`);
console.log(`Cleared ${this.name}'s inventory.`);
@ -511,21 +525,8 @@ export class Task {
this.agent.killAll();
}
}
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}")`);
}
await new Promise((resolve) => setTimeout(resolve, 500));
await this.setAgentGoal();
}

View file

@ -38,6 +38,7 @@ export class VLLM {
try {
console.log('Awaiting openai api response...')
// console.log('Messages:', messages);
// todo set max_tokens, temperature, top_p, etc. in pack
let completion = await this.vllm.chat.completions.create(pack);
if (completion.choices[0].finish_reason == 'length')
throw new Error('Context length exceeded');