Update brain.mjs

This commit is contained in:
Arma-Damna-Dillo 2025-02-08 03:33:18 +00:00
parent 3866261b02
commit 39b3266b53

View file

@ -86,12 +86,14 @@ class ConsciousnessApp {
// Start interactive conversation with the user
async startConversation() {
this.rl.question("You can start talking to the app. Type your message: ", async (input) => {
this.handleActivity(); // Update activity when the user types
while (this.isActive) {
const input = await new Promise((resolve) => {
this.rl.question("You can start talking to the app. Type your message: ", resolve);
});
this.handleActivity(); // Update activity when the user types
await this.userTalks(input); // App replies to user input
this.startConversation(); // Continue the conversation loop
});
}
}
async start() {
@ -109,7 +111,7 @@ async function main() {
// Optional: Simulate the user becoming inactive after 10 seconds and then becoming active again
setTimeout(() => {
app.isActive = false;
this.simulator.setUserActive(false); // User inactive (dreaming)
app.simulator.setUserActive(false); // User inactive (dreaming)
console.log("User is inactive... dreaming...");
}, 10000);