Update brain.mjs

This commit is contained in:
Arma-Damna-Dillo 2025-02-08 02:28:24 +00:00
parent 9e5510da20
commit 2134c26fc4

View file

@ -38,6 +38,7 @@ export class ConsciousnessSimulator {
} }
} }
this.logAIContextMemory() this.logAIContextMemory()
await this.updateEmotion()
} }
redefineSpecificOpinion(opinionKey, newValue) { redefineSpecificOpinion(opinionKey, newValue) {
@ -47,6 +48,7 @@ export class ConsciousnessSimulator {
console.log(`Opinion key "${opinionKey}" not found.`); console.log(`Opinion key "${opinionKey}" not found.`);
} }
this.logAIContextMemory() this.logAIContextMemory()
await this.updateEmotion()
} }
resetOpinions() { resetOpinions() {
@ -98,6 +100,7 @@ export class ConsciousnessSimulator {
}); });
this.logMemory('THOUGHT', `${response.message.content}`); this.logMemory('THOUGHT', `${response.message.content}`);
this.logAIContextMemory() this.logAIContextMemory()
await this.updateEmotion()
return response.message.content; return response.message.content;
} catch (error) { } catch (error) {
console.error("Error generating thought:", error); console.error("Error generating thought:", error);
@ -120,6 +123,7 @@ export class ConsciousnessSimulator {
this.logMemory('CHAT', `USER: ${prompt} this.logMemory('CHAT', `USER: ${prompt}
AI: ${response.message.content}`); AI: ${response.message.content}`);
this.logAIContextMemory() this.logAIContextMemory()
await this.updateEmotion()
return `USER: ${prompt} return `USER: ${prompt}
AI: ${response.message.content}`; AI: ${response.message.content}`;
} catch (error) { } catch (error) {
@ -170,6 +174,7 @@ export class ConsciousnessSimulator {
const emotion = emotion.message.content.toLowerCase() const emotion = emotion.message.content.toLowerCase()
this.currentEmotion = emotion this.currentEmotion = emotion
this.logAIContextMemory() this.logAIContextMemory()
await this.updateEmotion()
return emotion return emotion
} catch { } catch {
return "happy" return "happy"