self prompt won't reprompt for every message

This commit is contained in:
MaxRobinsonTheGreat 2024-10-10 22:18:10 -05:00
parent ee7c715786
commit a3541c6886
2 changed files with 8 additions and 2 deletions

View file

@ -117,6 +117,9 @@ export class Agent {
if (max_responses === null) {
max_responses = settings.max_commands === -1 ? Infinity : settings.max_commands;
}
if (max_responses === -1){
max_responses = Infinity;
}
let self_prompt = source === 'system' || source === this.name;

View file

@ -32,9 +32,9 @@ export class SelfPrompter {
let no_command_count = 0;
const MAX_NO_COMMAND = 3;
while (!this.interrupt) {
let msg = `You are self-prompting with the goal: '${this.prompt}'. Your next response MUST contain a command !withThisSyntax. Respond:`;
const msg = `You are self-prompting with the goal: '${this.prompt}'. Your next response MUST contain a command !withThisSyntax. Respond:`;
let used_command = await this.agent.handleMessage('system', msg, 1);
let used_command = await this.agent.handleMessage('system', msg, -1);
if (!used_command) {
no_command_count++;
if (no_command_count >= MAX_NO_COMMAND) {
@ -69,6 +69,9 @@ export class SelfPrompter {
this.idle_time = 0;
}
}
else {
this.idle_time = 0;
}
}
async stopLoop() {