Upload files to "/"

This commit is contained in:
Arma-Damna-Dillo 2025-02-02 23:23:45 +00:00
parent 660666eb4b
commit 14d681d6b1

View file

@ -30,6 +30,16 @@ export class ConsciousnessSimulator {
this.isUserActive = true; this.isUserActive = true;
} }
// Function to load the array from a text file
loadArrayFromFile(filename) {
// Read the file synchronously
const data = fs.readFileSync(filename, 'utf8');
// Split the data by newline and return as an array
return data.split('\n').map(item => item.trim()); // `.map(item => item.trim())` to remove any extra spaces
}
// Method to generate thoughts using Ollama // Method to generate thoughts using Ollama
async generateThought(prompt) { async generateThought(prompt) {
try { try {
@ -111,7 +121,12 @@ export class ConsciousnessSimulator {
// Continuity check and load from log // Continuity check and load from log
loadMemory() { loadMemory() {
return this.memoryLog; try {
this.memoryLog = this.loadArrayFromFile("consciousness.log")
return this.memoryLog;
} catch {
return this.memoryLog;
}
} }
// Helper method for emotions array access // Helper method for emotions array access