diff --git a/profiles/_default.json b/profiles/_default.json index c53765e..d27a630 100644 --- a/profiles/_default.json +++ b/profiles/_default.json @@ -149,7 +149,7 @@ {"role": "user", "content": "brug: Remember that your base is here."}, {"role": "assistant", "content": "Sure, I'll save this location as my base. !rememberHere(\"base\")"}, {"role": "user", "content": "brug: Go to your base."}, - {"role": "assistant", "content": "On my way! !goToPlace(\"base\")"} + {"role": "assistant", "content": "On my way! !goToRememberedPlace(\"base\")"} ], [ diff --git a/src/agent/agent.js b/src/agent/agent.js index dc26e8d..8b2de51 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -149,10 +149,15 @@ export class Agent { this.history.add('system', prompt); await this.self_prompter.start(prompt); } - else if (save_data?.last_sender) { + if (save_data?.last_sender) { this.last_sender = save_data.last_sender; - if (convoManager.isOtherAgent(this.last_sender)) - convoManager.recieveFromBot(this.last_sender, `You have restarted and this message is auto-generated. Continue the conversation with me.`); + if (convoManager.isOtherAgent(this.last_sender)) { + const package = { + message: `You have restarted and this message is auto-generated. Continue the conversation with me.`, + start: true + }; + convoManager.recieveFromBot(this.last_sender, package); + } } else if (init_message) { await this.handleMessage('system', init_message, 2); @@ -254,7 +259,7 @@ export class Agent { let history = this.history.getHistory(); let res = await this.prompter.promptConvo(history); - console.log(`${this.name} full response: ""${res}""`); + console.log(`${this.name} full response to ${source}: ""${res}""`); if (res.trim().length === 0) { console.warn('no response') diff --git a/src/agent/conversation.js b/src/agent/conversation.js index aadea3c..4e64029 100644 --- a/src/agent/conversation.js +++ b/src/agent/conversation.js @@ -60,6 +60,26 @@ class ConversationManager { return this.convos[name]; } + _startMonitor() { + clearInterval(this.connection_monitor); + this.connection_monitor = setInterval(() => { + if (!this.activeConversation) { + clearInterval(this.connection_monitor); + return; // will clean itself up + } + let cur_name = this.activeConversation.name; + if (!this.isOtherAgent(cur_name)) { + if (!self_prompter_paused) { + this.endConversation(cur_name); + agent.handleMessage('system', `${cur_name} disconnected, conversation has ended.`); + } + else { + this.endConversation(cur_name); + } + } + }, 10000); + } + async startConversation(send_to, message) { const convo = this._getConvo(send_to); convo.reset(); @@ -72,6 +92,7 @@ class ConversationManager { return; convo.active = true; this.activeConversation = convo; + this._startMonitor(); this.sendToBot(send_to, message, true); } diff --git a/src/agent/prompter.js b/src/agent/prompter.js index f23a028..b1b1317 100644 --- a/src/agent/prompter.js +++ b/src/agent/prompter.js @@ -247,13 +247,13 @@ export class Prompter { return generation; } this.awaiting_convo = false; - return ""; + return ''; } async promptCoding(messages) { if (this.awaiting_coding) { console.warn('Already awaiting coding response, returning no response.'); - return ''; + return '```//no response```'; } this.awaiting_coding = true; await this.checkCooldown();