fixed restart

This commit is contained in:
MaxRobinsonTheGreat 2023-12-12 13:39:35 -06:00
parent 48fd28a10f
commit 90ac954c04
3 changed files with 8 additions and 5 deletions

View file

@ -1,8 +1,11 @@
import { spawn } from 'child_process';
export class AgentProcess {
constructor(name, clear_memory=false, autostart=false) {
let args = ['controller/init-agent.js', name];
constructor(name) {
this.name = name;
}
start(clear_memory=false, autostart=false) {
let args = ['controller/init-agent.js', this.name];
if (clear_memory)
args.push('-c');
if (autostart)

View file

@ -1,3 +1,3 @@
import { AgentProcess } from './controller/agent-process.js';
new AgentProcess('andy', true, false);
new AgentProcess('andy').start(true, false);

View file

@ -91,7 +91,7 @@ export class Coder {
this.current_code = this.queued_code;
this.executing = true;
TIMEOUT = this._startTimeout(1);
TIMEOUT = this._startTimeout(10);
await execution_file.main(this.agent.bot); // open fire
this.executing = false;
clearTimeout(TIMEOUT);
@ -160,7 +160,7 @@ export class Coder {
if (this.executing) {
console.error(`Failed to stop. Killing process. Goodbye.`);
this.agent.bot.output += `\nForce stop failed! Process was killed and will be restarted. Goodbye world.`;
this.bot.chat('Goodbye world.');
this.agent.bot.chat('Goodbye world.');
let output = this.formatOutput(this.agent.bot);
this.agent.history.add('system', output);
this.agent.history.save();