mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-06-08 18:25:54 +02:00
fixed restart
This commit is contained in:
parent
48fd28a10f
commit
90ac954c04
3 changed files with 8 additions and 5 deletions
|
@ -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)
|
||||
|
|
2
main.js
2
main.js
|
@ -1,3 +1,3 @@
|
|||
import { AgentProcess } from './controller/agent-process.js';
|
||||
|
||||
new AgentProcess('andy', true, false);
|
||||
new AgentProcess('andy').start(true, false);
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue