Update brain.mjs
This commit is contained in:
parent
3866261b02
commit
39b3266b53
1 changed files with 7 additions and 5 deletions
12
brain.mjs
12
brain.mjs
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue