mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-27 09:23:03 +02:00
Update agent.js
This commit is contained in:
parent
f14f86a518
commit
15eb0fd1c6
1 changed files with 8 additions and 6 deletions
|
@ -91,6 +91,8 @@ export class Agent {
|
||||||
this._setupEventHandlers(save_data, init_message);
|
this._setupEventHandlers(save_data, init_message);
|
||||||
this.startEvents();
|
this.startEvents();
|
||||||
|
|
||||||
|
// this.task.initBotTask();
|
||||||
|
|
||||||
if (!load_mem) {
|
if (!load_mem) {
|
||||||
this.task.initBotTask();
|
this.task.initBotTask();
|
||||||
}
|
}
|
||||||
|
@ -156,10 +158,10 @@ export class Agent {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (save_data?.self_prompt) {
|
if (save_data?.self_prompt) {
|
||||||
let prompt = save_data.self_prompt;
|
if (init_message) {
|
||||||
// add initial message to history
|
this.history.add('system', init_message);
|
||||||
this.history.add('system', prompt);
|
}
|
||||||
await this.self_prompter.start(prompt);
|
await this.self_prompter.handleLoad(save_data.self_prompt, save_data.self_prompting_state);
|
||||||
}
|
}
|
||||||
if (save_data?.last_sender) {
|
if (save_data?.last_sender) {
|
||||||
this.last_sender = save_data.last_sender;
|
this.last_sender = save_data.last_sender;
|
||||||
|
@ -193,7 +195,7 @@ export class Agent {
|
||||||
|
|
||||||
shutUp() {
|
shutUp() {
|
||||||
this.shut_up = true;
|
this.shut_up = true;
|
||||||
if (this.self_prompter.on) {
|
if (this.self_prompter.isActive()) {
|
||||||
this.self_prompter.stop(false);
|
this.self_prompter.stop(false);
|
||||||
}
|
}
|
||||||
convoManager.endAllConversations();
|
convoManager.endAllConversations();
|
||||||
|
@ -259,7 +261,7 @@ export class Agent {
|
||||||
await this.history.add(source, message);
|
await this.history.add(source, message);
|
||||||
this.history.save();
|
this.history.save();
|
||||||
|
|
||||||
if (!self_prompt && this.self_prompter.on) // message is from user during self-prompting
|
if (!self_prompt && this.self_prompter.isActive()) // message is from user during self-prompting
|
||||||
max_responses = 1; // force only respond to this message, then let self-prompting take over
|
max_responses = 1; // force only respond to this message, then let self-prompting take over
|
||||||
for (let i=0; i<max_responses; i++) {
|
for (let i=0; i<max_responses; i++) {
|
||||||
if (checkInterrupt()) break;
|
if (checkInterrupt()) break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue